exit SYS_REFCURSOR when we do not know the structure of slider

If I have a variable of type 'SYS_REFCURSOR.
This cursor is passed to various procedures that open various recordset for this cursor, with different number of columns in the cursor.
How do all the output cursor columns?

1. maybe java will have metadata for cursor information and can produce the result set of the cursor. If so, then it's ok to choose this solution. VbScript is also ok, if it helps.

2. perhaps we can create temporary table based on the cursor. And table objects have meta-data in oracle system tables, I can output all the data slider.

3 perhaps I can use the so-called technique of try-catch to help sort clauses. For example
Try
  fetch cur1 into varchar2_var1, .., varchar2_var5
catch (if error)
      try
          fetch cur1 into varchar2_var1, .., varchar2_var4
...
Till we know how many fields there are.
somehow this way to go next
4. maybe execute immediate can help somehow.

If you're not in 11g and you have at least a few options of structures that you want to try and extract, you can make use of the exception rowtype_mismatch in intercepting and trying to get in a different structure until you find, start by nesting PL/SQL exception... the end. blocks.

You won't lose lines if you try to go get in the wrong structure.

In the example below, I'm trying to get in a guy with 2 columns and it fails then I try again against a 3-column type.

Note that the incompatibility of implicit conversions column type to lift other exceptions such as ORA-06504 or ORA-01722 for example.

Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Connected as fsitja

SQL> set serveroutput on
SQL>
SQL> DECLARE
  2    cur SYS_REFCURSOR;
  3    TYPE t_rec1 IS RECORD(
  4      col1 NUMBER,
  5      col2 VARCHAR2(100));
  6    v_rec1 t_rec1;
  7    TYPE t_rec2 IS RECORD(
  8      col3 NUMBER,
  9      col4 VARCHAR2(100),
 10      col5 VARCHAR2(100));
 11    v_rec2 t_rec2;
 12  BEGIN
 13    OPEN cur FOR
 14      SELECT 1 col3, 'a' col4, 'b' col5 FROM dual;
 15    FETCH cur
 16      INTO v_rec1;
 17    dbms_output.put_line('REC1.COL1: ' || v_rec1.col1);
 18    dbms_output.put_line('REC1.COL2: ' || v_rec1.col2);
 19  EXCEPTION
 20    WHEN rowtype_mismatch THEN
 21      FETCH cur
 22        INTO v_rec2;
 23      dbms_output.put_line('REC2.COL3: ' || v_rec2.col3);
 24      dbms_output.put_line('REC2.COL4: ' || v_rec2.col4);
 25      dbms_output.put_line('REC2.COL5: ' || v_rec2.col5);
 26  END;
 27  /

REC2.COL3: 1
REC2.COL4: a
REC2.COL5: b

PL/SQL procedure successfully completed

SQL> 

Tags: Database

Similar Questions

  • You can addItem() when you do not know the name of the column?

    I am trying to enter data into a DataGrid via XML. I do not know in advance what will be the names of the columns. I understand that it is supposed to function as:

    var sampleItem:Object = {ColName:10};

    dataGridMain.addItem (sampleItem);

    but it's no help if you don't know what will be the name of the column (column).

    Can I replace the value (10) with variables that match my xml values (output.row [0] .col [0]) and it works fine. But if I try to do the same for column name, it doesn't quite work. How can I use a dynamic of the names of columns in the dataGrid?

    gr8 to know that you have found the solution...

    Alternatively, you can make the dynamic columns same name as the name of the xml tag using dataprovider. Here's a simple example.

    ****************************************************************************************

    var dp:Array = new Array();

    var xml =
       
            TestTrack 1
            Band1
            test1.MP3
       
       
            TestTrack 2
            Wewayakai2
            test2.MP3
       
       
            TestTrack 3
            Band3
            test3.MP3
       
       
            TestTrack 4
            BAND4
            test4.MP3
       
    ;

    for (var i: int = 0; i
    var xmlc:XMLList = xml.track [i] .children ();
    var col1:String = (xmlc [0] as XML) .localName () as String
    var col2:String = xmlc [1] .localName () as String
    var col3:String = xmlc [2] .localName () as String
    var obj:Object = new Object();
    obj [col1] = xml.track [i] .title;
    obj [col2] = xml.track [i] .band;
    obj [col3] = xml.track [i] mpfprojectdir\dev10\src\csharp\projectbase.file;
    DP.push (obj);
    }

    dg.dataProvider = new DataProvider (dp);

    *****************************************************************************************

    Kind regards

    Karthikeyan R

  • How to install adobe on 2nd computer when we have a license but do not know the number?

    How to install adobe on 2nd computer when we have a license but do not know the number?

    You must have your serial number to install a version of the software that requires a serial number

    Lost information - response #1 in https://forums.adobe.com/thread/2008767 (for Mac or Windows programs)

    Find your http://helpx.adobe.com/x-productkb/global/find-serial-number.html serial No.

  • PresarioCQ62: My laptop locked out and do not know the administrator password or power on password. Help!

    I bought a laptop from someone & when I turned it on it was locked & I do not know the password.

    As soon as I turn it on it says "power on password or administrator password.

    When I type a password after 3 tries & is incorrect, it says 'Disabled system' the code is: 66250741

    I never had this problem & im not at 100% in computing either. I know how to make it work, but I've never heard of an admin password. Can someone help me?

    The model is CQ62-219WM

    Hello

    Enter: 79138387

    Kind regards

    DP - K

  • I get the windows login screen and I do not know the password for administrators

    I accidentally deleted my account and when the computer starts and I get the windows login screen and I do not know the administrators password. Also how can I reinstall windows when I got a disc when I brought my laptop. Thank you, Lorraine

    Thanks for getting back to me. I sold my old laptop to my son-in-law, and he asked me to remove my name from the computer off so that my name wasn't on the screen all the time. so I deleted the profile of cook of lorraine and made one for him, but I didn't give it a password. then I realized what I had to do (I got Lorraine where time is on the bottom of the screen), but was unable to highlight to remove it without a mouse. so I plugged a mouse, but the computer does not read, then I restarted the computer. When I restarted, all I could get was the windows login screen.

    then I typed in the name son-nlaws and they said that he was kidnapped, tyoed in mine and got the same and then typed in Administrator, but did not know the password. I have since reinstalled windows. XP Professional would not install saying a file was missing, so I installed xp family and is working again. He just has to click on what edition it wants to run. Professional XP of course happen just with the display of connection... but it can use again.
    Thank you once again, Lorraine

  • computer inheirerted of father and you want to restore the factory installed vista system but do not know the password of admin fathers

    computer inheirerted of father and you want to restore the factory installed vista system but do not know the password of admin fathers

    Hello

    You should not have a password to reinstall Vista.

    Microsoft prohibits any help given in these Forums for you help bypass or "crack" passwords lost or forgotten.

    Here's information from Microsoft, explaining that the policy:

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/keeping-passwords-secure-Microsoft-policy-on/39f56ef0-5d68-41AD-9daa-6e6019c25d37

    There are several methods to reinstall Vista.

    There is no Windows Vista downloads available from Microsoft.

    You can contact your computer manufacturer and ask them to send you a set of recovery disks.

    They should do this for a small fee.

    To reinstall Vista using their recovery disk/s, you start from the 1st recovery disk they provide and follow the manufacturer's instructions to reinstall:

    You need to change the Boot order to make the DVD/CD drive 1st in the boot order:

    How to change the Boot order in BIOS:

    http://pcsupport.about.com/od/fixtheproblem/SS/bootorderchange.htm

    And if you have never received a recovery disk when you bought your computer, there should be a recovery Partition on the hard drive to reinstall Vista on how you purchased your computer.

    The recovery process can be started by pressing a particular combination of the key or keys at startup. (Power on / start)

    Maybe it's F10, F11, Alt + F10, etc., depending on the manufacturer.

    Ask them to the proper key sequence.

    Some manufacturers have more available Vista recovery disks.

    If this happens, you may need to try this instead:

    You can also borrow and use a Microsoft Vista DVD, which contains the files for the different editions of Vista (Home Basic, Home Premium, Business and Ultimate) must be installed. The product key on your computer / Laptop box determines what Edition is installed.

    Other manufacturers recovery DVDs are should not be used for this purpose.

    And you need to know the version of 'bit' for Vista, as 32-bit and 64-bit editions come on different DVDs

    Here's how to do a clean install of Vista using a DVD of Vista from Microsoft:

    "How to do a clean install and configure with a full Version of Vista '

    http://www.Vistax64.com/tutorials/117366-clean-install-full-version-Vista.html

    And once the operating system is installed, go to your computer manufacturer's website and get the latest drivers for your particular model or laptop computer.

    And phone Activation may be necessary when you use the above installation method.

    "How to activate Vista normally and by Activation of the phone '

    http://www.Vistax64.com/tutorials/84488-activate-Vista-phone.html

    See you soon.

  • Bought this used system and do not know the administrator password to log on.

    password to administer

    I bought this computer from a widow who does not know the password manage... HELP ME PLEASE,

    Forgotten password:

    You can try a number of things, please see the following articles:

    http://www.howtogeek.com/HOWTO/Windows-Vista/enable-the-hidden-administrator-account-on-Windows-Vista/

    Or: http://www.sevenforums.com/tutorials/507-built-administrator-account-enable-disable.html

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-to-do-if-you-forget-your-Windows-password

    Credit: Ronnie Vernon MVP

    If you have an installation of Windows 7 disk, see the following article.

    How to use system restore to log on Windows 7 or Windows Vista when you lose access to an account

    Unfortunately, beyond that we can not help you. Please review the following policies for these forums and Microsoft.

    Answers Support Forums password policy

    Keep secure passwords - Microsoft strategy on move the passwords

    Microsoft's official policy

    Microsoft's strategy concerning lost or forgotten passwords

    Since it is a second hand bought computer, if it came preloaded with Windows 7, its better if you reinstall Windows 7:

    New computers coming often pre-installed with Windows 7 have what is called a recovery partition. This is used to reinstall an operating system in the case of a system failure. To access it, you need to start when you start your computer by pressing a function key. This can be either F1, F2, F9, F10, F11, F12 key DEL or tab. See the manual that came with your PC for instructions on how to reinstall Windows.

    If your recovery partition is not available or damaged, you must contact the manufacturer of your computer, and request that a defined recovery disk you can use to reinstall Windows 7. They could practice a small shipping and handling.

    ------------------------------------

    This is how the recovery partition is available for the most popular brands

    For Dell, press CTRL + F11 directly after switching on the device

    For HP, press F11 directly after switching on the device

    For Toshiba, press and hold "0" BEFORE and during the power upward

    For Acer, press and hold ALT + F10, as soon as you see the logo

    For Asus, press F9, as soon as you see the Asus logo.

    Advent, restart your computer. Then, press F10 repeatedly until the message "Starting system recovery"

  • How to make safari when he is not on the list update available

    How to update Safari when he is not on the list of updates?

    If you use OS X Lion mountain 10.8.5 as indicated in your signature, the latest version of Safari you might install is Safari 6.2.8 and it is no longer supported.

    Your options are to be upgraded to a later version of OS X or use a browser that is still supported. The current version of Firefox is still supported, but which is also coming to an end: https://blog.mozilla.org/futurereleases/2016/04/29/update-on-firefox-support-for - os - x /

  • After that installation of 9.3 iPad will not activate, it has been restored, but still not turn on. The first owner does not know the password

    After that installation of 9.3 iPad will not activate, it has been restored, but still not turn on. The first owner does not know the password

    And this is not recognitze by any device, computer or iPhone 6plus.

    If you or the original owner did not have the password no one here or at Apple can help you.

  • I want to change your security questions and do not know the old issues and thank you

    I want to change your security questions and do not know the old issues and thank you

    If you have an emergency email address you can use to reset your questions. This option of rescue should be on https://id.apple.com after connection and asked for security issues. If this is not leading to a solution, call Apple: Apple for support and service - Apple Support Contact

    Be prepared to identify you as the account holder. They will ask you some things, I can't predict what, but usually the serial numbers or credit card.

  • Re: Equium M50 - do not know the admin password

    Need to run the recover console on my M50 pre-installed, but do not know the password - HELP!

    Hi loneraver,

    Why you n t know the admin password? Normally all passwords will be defined by the user, or in other words, I suppose that you have set all passwords.

    Unfortunately if you n t know the password more you have to reinstall the entire operating system. So take the Toshiba Recovery disk or the Microsoft disk to reinstall Windows.

  • In all the hearts of Windows games, it seems that they do not know the rules. The Queen of Spades is just like a heart in the real rules

    In all the hearts of Windows games, it seems that they do not know the rules.  The Queen of Spades is just like a heart in the real rules. I don't have to play the Queen.  If hearts have been broken, and all I have left is some hearts and the Queen of Spades, I can play a weak heart rather than being forced to play the Queen.  The windows game apparently does not know this rule.

    original title: rules of hearts

    Hello

    Actually if the Queen of Spades breaks hearts and cannot therefore be considered a heart
    is optional. The basic rule is that the Queen of Spades does not break hearts and must be conducted
    If a player has the Queen of spades and still hearts if hearts have been broken.

    My preferences are the Queen of Spades or a heart can be played on the 1st round Sub in the Clubs.
    And the Queen of Spades does not break the hearts and must be conducted if only he and hearts are
    left in the hands and hearts have not been broken. Those who make for much more difficult game
    MY HUMBLE OPINION.

    Hearts
    http://www.Pagat.com/reverse/hearts.html

    Hearts, the rules
    http://www.toycrossing.com/hearts/basic-rules.shtml

    Hearts
    http://en.Wikipedia.org/wiki/hearts

    Hearts
    http://www.kemenel.org/cards/hearts.php

    Plays in the heart and stings for years, but the bridge is even more fun.

    Bridge Base online - play for free at all levels (beginner to the World Champions and yes the world
    Champions play there - it has same vugraphs live tournaments around the world - free.)
    http://www.bridgebase.com/

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • I'm trying to get an e-mail account, but I do not know the password.

    I'm recovering from an e-mail account that someone put in place and I do not know the password. I have answered the safety question and tells me that it is the wrong answer. I know that it is correct. Any ideas?

    original title: security for e-mail question

    Hello

    You need work with the help of the mail provider anyone can be.

    If it's Hotmail or Windows Live Mail, see in these forums.

    Answers - Hotmail, Messenger, and SkyDrive (and all things, Windows Live)
    http://answers.Microsoft.com/en-us/windowslive

    This message is moved to this forum since they are the only ones who can answers
    Assist. Please let us know if you do not have Hotmail or Windows Live Mail.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Unable to connect to facebook, do not know the secret question

    you forgot a secret question, how?

    as I start the facebook game, I really don't have e-mail account, is my friend helpme register, so I do not know the secret question, but today, I can not connect log in my facebook account and e-mail, to feel that my account is compromised, while I have not 1 get new facebook account , I try so many times still cant, then my friend tell me a few year already, he can't forget wht secret the answer filling up, so wht can I do?

    Hi limseng,

    Please see the facebook support for help.

  • Password reset: I'm using vista I forgot the password to the file encreption and I do not know the supervisor password

    I'm using vista I forgot the password to the file encreption and I do not know the supervisor password. Thanks for the help

    I'm using vista I forgot the password to the file encreption and I do not know the supervisor password. Thanks for the help

    Can't do anything without your password 'supervisor '. Go talk to this person.

    We are not allowed to help users to bypass the administrator password protection. Penalty should be banned from all the Microsoft forums.

    t-4-2

Maybe you are looking for

  • iPhone 6 Carplay is available in which cars?

    I may buy a new car in 2016. I wonder what cars use Carplay in their entertainment systems?

  • I said I need to defragment my computer... How can I do this?

    My computer is running REALLY slow. How do I defragment?

  • Error loading C:\WINDOWS\system32\shimgvw.dll

    Hello everyone, Recently, I received a very troublesome machine I have don't seem to not be able to solve. He began with thumbnails of Image not appearing is not in Windows Explorer. Since then, I have studied the issue widely and have not yet found

  • How can I get my vista returns with no password?

    My hard drive crashed. IM waiting to get a new internal hard drive and apparently my files is stored on an external hard drive that I bought recently. Now I realize I lost not only the recovery disks for my windows vista 64 bit, I also lost the box t

  • Several blue screen errors

    Hello I have recently, in the course of the last days had a lot of bluescreens, about 2 per day. But today, it was three in a row. I just recently did a clean install (December). I know that the problem was caused after a windows update. Im guessing