DBMS_TYPES with timestamp and interval does not seem to work.
I have a PL/SQL script that seems to work for char,varchar,numerics, dates, but not for intervals. I basically took example code out of the Oracle manuals and stitched it together.
The code in question is the function colTypeString. Apparently, interval is not being recognized as a type, so the function is returning back unknown. The documentation seems a bit spartan, so I thought perhaps you can help me out.
Thanks.
Here's the code:
create table interval_test( intym interval year(4) to month, intdm interval day(3) to second(4) );
execute oraforum_pkg.desc_query( 'select * from interval_test' );
col_type = 182, UNKNOWN_TYPE
col_maxlen = 5
col_name = INTYM
col_name_len = 5
col_schema_name =
col_schema_name_len = 0
col_precision = 4
col_scale = 0
col_null_ok = true
col_type = 183, UNKNOWN_TYPE
col_maxlen = 11
col_name = INTDM
col_name_len = 5
col_schema_name =
col_schema_name_len = 0
col_precision = 3
col_scale = 4
col_null_ok = true
PL/SQL procedure successfully completed.
Here's the package:
-- Define the ref cursor types and function
CREATE OR REPLACE PACKAGE oraforum_pkg IS
FUNCTION colTypeString( typeId in integer) return varchar2; -- typeId from dbms_types
PROCEDURE print_rec(rec in DBMS_SQL.DESC_REC);
PROCEDURE desc_query( selectSql in varchar2 );
END oraforum_pkg;
CREATE OR REPLACE PACKAGE BODY oraforum_pkg IS
FUNCTION colTypeString( typeId in integer)
return varchar2 -- typeId from dbms_types
is
rval varchar2(40) := 'Unknown';
BEGIN
case typeId
when DBMS_TYPES.NO_DATA then rval := 'NO_DATA' ;
when DBMS_TYPES.SUCCESS then rval := 'SUCCESS' ;
when DBMS_TYPES.TYPECODE_BDOUBLE then rval := 'BDOUBLE' ;
when DBMS_TYPES.TYPECODE_BFILE then rval := 'BFILE' ;
when DBMS_TYPES.TYPECODE_BFLOAT then rval := 'BFLOAT' ;
when DBMS_TYPES.TYPECODE_BLOB then rval := 'BLOB' ;
when DBMS_TYPES.TYPECODE_CFILE then rval := 'CFILE' ;
when DBMS_TYPES.TYPECODE_CHAR then rval := 'CHAR' ;
when DBMS_TYPES.TYPECODE_CLOB then rval := 'CLOB' ;
when DBMS_TYPES.TYPECODE_DATE then rval := 'DATE' ;
when DBMS_TYPES.TYPECODE_INTERVAL_DS then rval := 'INTERVAL_DS' ;
when DBMS_TYPES.TYPECODE_INTERVAL_YM then rval := 'INTERVAL_YM' ;
when DBMS_TYPES.TYPECODE_MLSLABEL then rval := 'MLSLABEL' ;
when DBMS_TYPES.TYPECODE_NAMEDCOLLECTION then rval := 'NAMEDCOLLECTION' ;
when DBMS_TYPES.TYPECODE_NUMBER then rval := 'NUMBER' ;
when DBMS_TYPES.TYPECODE_OBJECT then rval := 'OBJECT' ;
when DBMS_TYPES.TYPECODE_OPAQUE then rval := 'OPAQUE' ;
when DBMS_TYPES.TYPECODE_RAW then rval := 'RAW' ;
when DBMS_TYPES.TYPECODE_REF then rval := 'REF' ;
when DBMS_TYPES.TYPECODE_TABLE then rval := 'TABLE' ;
when DBMS_TYPES.TYPECODE_TIMESTAMP then rval := 'TIMESTAMP' ;
when DBMS_TYPES.TYPECODE_TIMESTAMP_LTZ then rval := 'TIMESTAMP_LTZ' ;
when DBMS_TYPES.TYPECODE_TIMESTAMP_TZ then rval := 'TIMESTAMP_TZ' ;
when DBMS_TYPES.TYPECODE_VARCHAR2 then rval := 'VARCHAR2' ;
when DBMS_TYPES.TYPECODE_VARCHAR then rval := 'VARCHAR' ;
when DBMS_TYPES.TYPECODE_VARRAY then rval := 'VARRAY' ;
else rval := 'UNKNOWN_TYPE';
end case;
return rval;
END;
PROCEDURE print_rec(rec in DBMS_SQL.DESC_REC) IS
BEGIN
DBMS_OUTPUT.PUT_LINE('col_type = '
|| rec.col_type || ', ' || colTypeString(rec.col_type) );
DBMS_OUTPUT.PUT_LINE('col_maxlen = '
|| rec.col_max_len);
DBMS_OUTPUT.PUT_LINE('col_name = '
|| rec.col_name);
DBMS_OUTPUT.PUT_LINE('col_name_len = '
|| rec.col_name_len);
DBMS_OUTPUT.PUT_LINE('col_schema_name = '
|| rec.col_schema_name);
DBMS_OUTPUT.PUT_LINE('col_schema_name_len = '
|| rec.col_schema_name_len);
DBMS_OUTPUT.PUT_LINE('col_precision = '
|| rec.col_precision);
DBMS_OUTPUT.PUT_LINE('col_scale = '
|| rec.col_scale);
DBMS_OUTPUT.PUT('col_null_ok = ');
IF (rec.col_null_ok) THEN
DBMS_OUTPUT.PUT_LINE('true');
ELSE
DBMS_OUTPUT.PUT_LINE('false');
END IF;
DBMS_OUTPUT.PUT_LINE('');
END;
PROCEDURE desc_query( selectSql in varchar2 ) IS
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
BEGIN
c := DBMS_SQL.OPEN_CURSOR; -- Is this needed for parsing? Yes, as argument to PARSE
DBMS_SQL.PARSE(c, selectSql, DBMS_SQL.NATIVE);
-- d := DBMS_SQL.EXECUTE(c); -- Doesn't look necessary.
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
* Following loop could simply be for j in 1..col_cnt loop.
* Here we are simply illustrating some of the PL/SQL table
* features.
col_num := rec_tab.first;
IF (col_num IS NOT NULL) THEN
LOOP
print_rec(rec_tab(col_num));
col_num := rec_tab.next(col_num);
EXIT WHEN (col_num IS NULL);
END LOOP;
END IF;
DBMS_SQL.CLOSE_CURSOR(c);
END;
END oraforum_pkg;
Message was edited by:
user554561
The issue is that DBMS_SQL and DBMS_TYPES have different typecodes. Which means you can't interrogate the DBMS_SQL.DESC_REC using DBMS_TYPES constants. You could create yourself a package of DBMS_SQL_TYPES.
SQL> create table t ( ts timestamp, iv interval day to second );
Table created.
SQL>
SQL> insert into t values ( systimestamp, interval '1' second );
1 row created.
SQL>
SQL> declare
2 c integer := dbms_sql.open_cursor ();
3 rec_tab dbms_sql.desc_tab;
4 col_cnt integer;
5 begin
6 dbms_sql.parse (c, 'select * from t', dbms_sql.native);
7 dbms_sql.describe_columns (c, col_cnt, rec_tab);
8
9 for i in 1 .. col_cnt
10 loop
11 dbms_output.put_line ('Name: ' || rec_tab (i).col_name || '; Type: ' || rec_tab (i).col_type);
12 end loop;
13
14 dbms_sql.close_cursor (c);
15
16 dbms_output.put_line ('DBMS_TYPES.TYPECODE_TIMESTAMP; Type: ' || DBMS_TYPES.TYPECODE_TIMESTAMP);
17 dbms_output.put_line ('DBMS_TYPES.TYPECODE_INTERVAL_DS; Type: ' || DBMS_TYPES.TYPECODE_INTERVAL_DS);
18
19 end;
20 /
Name: TS; Type: 180
Name: IV; Type: 183
DBMS_TYPES.TYPECODE_TIMESTAMP; Type: 187
DBMS_TYPES.TYPECODE_INTERVAL_DS; Type: 190
PL/SQL procedure successfully completed.Regards
Similar Messages
-
My iMovie 11 movie has clips that have some extracted audio that I would like to use for the menu music in iDVD 11. Does anyone know how to do this? Copy and paste does not seem to work.
I would use Quicktime Pro.
See: QuickTime Pro: How to Extract or Disable Tracks at http://docs.info.apple.com/article.html?artnum=42596 and QuickTime Player 7 Help - Extracting, Adding, and Moving Tracks at http://docs.info.apple.com/article.html?path=QuickTime%20Player/7/en/c3qt6.html
To get Quicktime 7.6.6 for Snow Leopard see: QuickTime Player 7.6.6 for Mac OS X v10.6.3 at http://support.apple.com/kb/DL923 (Quicktime 7.6.6 is the latest version.)
To upgrade to Quicktime Pro see: QuickTime Player 7 Help - Getting QuickTime Pro at http://docs.info.apple.com/article.html?path=QuickTime%20Player/7/en/c2qt.html -
With Windows 7 I upgraded itunes to 11. Now in my itunes library, when I click on a song "original file could not be found" comes up. This happens with over 2000 songs, but it seems to be ones I recorded from cd's. Locate does not seem to work. Has anyone else had this problem?
Highlight a song that is supposedly missing, press CTRL+I to Get Info, say no when asked to locate the file, then look at the summary tab. Where does iTunes "think" the file should be? Where is it really? You may need to give a configuration file a minor tweak.
tt2 -
I bought my daughter a new MacbookPro 13" for grad school and selected the HP Envy 100 printer from the Apple Store website. When I just tried to install the printer, it said that that the software was not compatable with Lion. Any suggestions as to how to get it to work?
Sorry, but the response just takes you to the HP site which is of all possible assistance short of actual help!!
HP (and Apple?) need to fess up and tell all the people who have HP printers when they will "just work" with their machines and OS X Lion.... because for many of us, they just don't! It isn't rocket science guys.... blithely telling us that downloading S/W updates from Apple doesn't help.... because they don't solve the problems! -
having trouble downloading and launching trial version of captivate. Using a Windows 32bit system. When I try to launch -- get error message that says "the procedure entry point NormalizeString could not be located in the dynamic link library KERNEL32.dll"
Troubleshoot with install logs | CS5, CS5.5, CS6, CC
-
%rowtype and %type does not seem to work for 8i
Hello,
I have tried to define a package and in the package
specification I have defined
type abc is ref cursor return qq%rowtype;
The table qq exists and I can see it, insert into it.
I have got an error, when I declare a procedure with
formal parameters using %type inside a package specification.
After changing %type to number I can compile.
When I declare an anonymous block with %rowtype definition I am fine.
According to the documentation %rowtype and %row are allowed in packages. Is it a well known bug?Do you have direct grant on the QQ table or is it role based?
Role based access is not recognized in PL/SQL stored procedures. -
The three finger swipe left and right does not seem to work
Hi
I have been trying to do the left and right three finger swipe that allows you to move between applications to no avail. It just keeps switching between dashboard and one app even if I have 5 apps open at the same time. Snow Leopard has this feature where all the apps opened are shown when you do the swipe and you can choose the one you want. I think this is better but it doesn't work.
Any help will be appreciated.
AntonioSuch spaces actually use very little extra memory relative to the apps you have open to occupy those spaces. I would go out on a limb and say it doesn't matter whether you have one space for every application or all on the same desktop.
The limitation will come from the applications and the data you are crunching on them.
(But that's just a personal view, haven't run into any limits on my ow 4GB Macbook Pro so far) -
When I try to run a slideshow it acts like it is running but the screen is black with no pictures.
When I try to run a slideshow it acts like it is running but the screen is black with no pictures.
-
Paypal for Family Sharing - Why can't I use PayPal with Family Sharing? Have a US Visa card but a foreign address, and Apple does not seem to be able to cope with that (even though it is a multinational corporation). So I set up payment with Paypal, and it worked fine. Now I want to take advantage of Family Sharing, but Apple won't allow it. Could we lean on Apple to change this policy?
If you are not in the US then you cannot use the US store, the store's terms say that you have to be in a country to use it - if you are using the US store then you are risking having your account disabled.
In terms of feedback for Apple : http://www.apple.com/feedback/ -
I use an iPad. It automatically switched me from old-fashioned Acrobat to DC. How do I delete docs that were put on my iPad with the old Acrobat? They are not in the cloud, and DC does not seem to have a delete function for them.
Hi,
By default, Acrobat DC for iOS displays recently viewed files. You need to switch to other file location (such as Local, Document Cloud, Creative Cloud) to delete, rename, move, or duplicate files.
You can switch to Local, if you would like to see the files and folders that are locally stored on your iPad.
Would you take a look at the following document to see how you can switch to other file location and delete files?
How to manage files in Acrobat DC for iOS
Please let us know if you have additional questions. Thank you. -
I have just bought a iphone 4s of someone and it does not seem to have siri can anyone help me
i have just bought an iphone 4s off someone and it does not seem to have siri can anyone help me
If you are using English as your language, then Siri should be available.
Have you registered your iPhone with Apple? If not, please do to confirm that you in FACT have an iPhone 4S.
You can do so here:
https://register.apple.com/cgi-bin/WebObjects/GlobaliReg.woa
Or check your device without registering it here:
https://selfsolve.apple.com/agreementWarrantyDynamic.do -
Help: Just finished shooting a wedding and Aperture crashes constantly during editing. All pic's in RAW and even after making sure I have the latest Aperture update, I have had to rebuild my library twice and "repair" does not seem to fix the issue. Help?
Well!
If you have ThunderBolt, I would go with such for an External Working Drive, spinning platter or SSD depending on your budget
This does not have to be huge just big enough to house your most current Jobs
Once the Current Job is put to rest I would move it to a larger multi bay hard drive unit, USB or FireWire nothing fancy, no RAID, set up as one single Disk
This would only be accessed when something is needed from a past Job so the connection does not have to be speedy
The Drobo would be relegated to Vaults and backups
You can set up a Vault on the Drobo to back up the External Working Library and then Reconnect it when you have moved the Library over to the other Enclosure
This has worked for me pretty smoothly for a long while, but I have found over the years that one can not assume all people work in the same manner! :-) -
The search feature in messages does not seem to work with pre IOS 7 messages
After updating to IOS 7 the search feature in the Messages app does not seem to work with messages received prior to the update. Texts received since the IOS 7 update search correctly. Is this a bug or a feature of moving to iMessages rather than just receiving standard texts?
Although not related to your question you have outdated ShockWave Flash Player go ahead and update your flash player by going to www.get.adobe.com/flashplayer
As for your problem, One of your add-ons might be the culprit too. Try running Firefox in [[Safe Mode]] with all add-ons disabled. If that solves the problem, see [[Troubleshooting extensions and themes]] and possibly [[Troubleshooting plugins]] -
Copy and paste of an element does not seem to work in the web page design??
I have tried to copy and paste of an element BUT it does not seem to work in the web page design??
Hi;
The copy and paste keyboard commands in the app are controlled by Flash Player, sometimes there are issues with a browser/OS combination, make sure that Flash Player is up to date and if that doesn't help try another web browser.
Thanks,
Josh -
I am now using v3.6.8 and tried updating to v7.01 but it does not seem to work. Went to control panel to remove all the old versions but Firefox was not listed there although Thunderbird is there. Please advise asap, thanks
I recommend backing up your Firefox settings in case something goes wrong during the uninstall/reinstall process. See [https://support.mozilla.com/en-US/kb/Backing+up+your+information Backing up your information]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)
In the Control Panel, Add/Remove programs, look for '''Mozilla Firefox'''. Make sure to save (do not delete) your personal settings when uninstalling.
If it isn't there, just try installing 3.6.23, which is the latest in the 3.6 family. You can download 3.6.23 here: http://www.mozilla.com/firefox/all-older
With respect to version 7.0.1, are you saying that the installation failed, or it seemed to work but it's nowhere to be found?
Maybe you are looking for
-
Need advice on bluetooth driver and software download
*PLEASE HELP*: just bought a Nexus bluemicro pro bluetooth v2.1 dongle. and ive damaged the disk it came with when I was opening the packet. The disk says: Toshiba bluetooth driver and software bluetooth BT1.2/2/0/2.1. Does anyone know if there is a
-
Hi, Does Adobe Reader have the capability to save edited documents to the ipad itself rather than acrobat.com I work in remote areas and we are looking at making out collection forms electronic. We usually do not have an internet connection but we w
-
How can I import address book info from old mac to new one?
Just got a macbook, and migrated all the info as per instructions. Now I need to get all the info from my old address book to the new one. Spent about 6 hours today trying to figure this out, and an hour of that was spent on the phone with a friendly
-
TableView in JSP - Nonclickable Cells
Hi, I have a TableView in a JSP. Some cells in it are clickable (like tje first column and the headerline) How can I set the whole table non-clickable? Thanks ahead, Burkhardt
-
Busy signal when trying to call out while vacationing in Puerto Rico. How can I fix this problem?