Trying to get rows to ResultSet with CallableStatement and stored functio

Hello!
I'm using JDBC with Oracle XE 11g2, driver ojdbc6.jar (Oracle Database 11g Release 2 (11.2.0.3) JDBC Drivers, JDBC Thin for All Platforms) from oracle.com
I've got a table
CREATE TABLE ORGANIZATIONS
CODE VARCHAR2(4),
DESCRIPTION VARCHAR2(255)
And I'm trying to get all organizations into ResultSet using CallableStatement with stored function:
CallableStatement cs = connection.prepareCall("{? = call FN_GET_ROWS}");
cs.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR);
cs.execute();
I've created two types:
CREATE OR REPLACE
TYPE TEST_OBJ_TYPE AS OBJECT (
CODE VARCHAR2(4),
DESCRIPTION VARCHAR2(255)
and
CREATE OR REPLACE
TYPE TEST_TABTYPE AS TABLE OF TEST_OBJ_TYPE
and my function is
CREATE OR REPLACE
FUNCTION FN_GET_ROWS RETURN TEST_TABTYPE AS V_Test_Tabtype Test_TabType;
BEGIN
SELECT TEST_OBJ_TYPE(A.CODE, A.DESCRIPTION)
BULK COLLECT INTO V_Test_TabType
FROM
(SELECT CODE, DESCRIPTION
FROM ASM.ORGANIZATIONS
) A;
RETURN V_Test_TabType;
END;
but when I run my program I've got error:
P LS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

It doesn't look like your PL/SQL Function is returning a REF CURSOR to me. It looks like you are returning a PL/SQL Index-By table of Objects.
Regards,
Mark

Similar Messages

  • Trying to get Photoshop CS4 functional with Mavericks and an Epson 3880 printer. CS4 fails to send a file to the print queue. Have reinstalled the Epson 3880 driver for Mavericks. All looks good but no file is sent.

    rying to get Photoshop CS4 functional with Mavericks and an Epson 3880 printer. CS4 fails to send a file to the print queue. Have reinstalled the Epson 3880 driver for Mavericks. All looks good but no file is sent.
    Does anyone know how to fix this?

    What EXACT version of Photoshop CS4 are you running?  You should be on Photoshop CS4 v 11.0.2.
    Also run Apple's software update to see whether it offers you the latest Epson update:
    Printer Driver v9.33
    Epson Stylus Pro 3880, Drivers & Downloads - Technical Support - Epson America, Inc.
    MOST IMPORTANTLY:  have Photoshop re-create its own Preferences:
    To re-create the preferences files for Photoshop, start the application while holding down Ctrl+Alt+Shift (Windows) or Command+Option+Shift (Mac OS). Then, click Yes to the message, "Delete the Adobe Photoshop Settings file?"
    Note: If this process doesn't work for you while you're using a wireless (Bluetooth) keyboard, attach a wired keyboard and retry.
    Important: If you re-create the preferences by manually deleting the Adobe Photoshop CS6 Settings file, make sure that you only delete that file. If you delete the entire settings folder, you also delete any unsaved actions or presets.
    Reinstalling Photoshop does not remove the preferences file. Before reinstalling Photoshop, re-create your preferences.
    NEW Video! Julieanne Kost created a video that takes you through two ways of resetting your Photoshop preferences. The manual preference file removal method is between 0:00 - 5:05. The keyboard shortcut method is between 5:05 - 8:18. The video is located here:
    How to Reset Photoshop CS6’s Preferences File | The Complete Picture with Julieanne Kost | Adobe TV
    Mac OS
    Important: Apple made the user library folder hidden by default with the release of Mac OS X 10.7. If  you require access to files in the hidden library folder to perform Adobe-related troubleshooting, see How to access hidden user library files.

  • Trying to get 3d to work with xbr70x850b and bdp-s7200

    have new xbr70x850b and new bdp-s7200.  Using Exodus to experiement.  BD says disk is 3d.  tv lets me into 3d menu so it seems to think the feed is 3d.  but none of the menu items (side by side, over/under) are present.  Glasses are registered and turned on.  BD connected directly into tv with new hdmi cable.  Have tried lots of setting changes on tv and bd, but can't get any of the 3d menu options to appear on tv.  3d works with streaming samples from youtube.  Just not with BD. Any hints?  very frustrating. 

    Ok I have been following the instructions supplied on this website http://www.zentus.com/sqlitejdbc/usage.html.
    I have downloaded the jar and the dll file and have placed them into the same folder as my jar file. Then as it says I enter into the command line:
    "java -cp sqlitejdbc.jar - Djava.library.path=. - jar CBL_Program.jar" and I get this:
    Exception in thread "main" java.lang.ClassNotFoundException: org.sqlite.JDBC
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at cblprogram.Main.main(Main.java:28)
    Which seems to be the same exception as when I run the program from netbeans.
    I am really stumped on this one, please can someone help.

  • Trying to get row counts for all tables at a time

    Hi,
    i am trying to get row counts in database at a time with below query but i am getting error:
    its giving me ora-19202 error..please advise me
    select
          table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name))
              ,'/ROWSET/ROW/C')
              count
        from all_tables;

    ALL_TABLES returns tables/views current user has access to. These tables/views are owned not just by current user. However your code
    dbms_xmlgen.getxml('select count(*) c from '||table_name)does not specify who the owner is. You need to change it to:
    dbms_xmlgen.getxml('select count(*) c from '||owner || '.' || table_name)However, it still will not work. Why? As I said, ALL_TABLES returns tables/views current user has access to. Any type of access, not just SELECT. So if current user is, for example, granted nothing but UPDATE on some table the above select will fail. You would have to filter ALL_TABLES through ALL_SYS_PRIVS, ALL_ROLE_PRIVS, ALL_TAB_PRIVS and PUBLIC to get list of tables current user can select from. For example, code below does it for tables/views owned by current user and tables/views current user is explicitly granted SELECT:
    select
          t.owner,
          t.table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.owner || '.' || t.table_name))
              ,'/ROWSET/ROW/C')
              count
        from all_tables t,user_tab_privs p
        where t.owner = p.owner
          and t.table_name = p.table_name
          and privilege = 'SELECT'
    union all
    select
          user,
          t.table_name,
          to_number(
            extractvalue(
              xmltype(dbms_xmlgen.getxml('select count(*) c from '||t.table_name))
              ,'/ROWSET/ROW/C')
              count
        from user_tables t
    OWNER                          TABLE_NAME                                                          COUNT
    SCOTT                          DEPT                                                                    4
    U1                             QAQA                                                                    0
    U1                             TBL                                                                     0
    U1                             EMP                                                                     1
    SQL> SY.

  • I have a Power Mac G4 and i am trying to get it to work with my LCD

    I have a Power Mac G4 and i am trying to get it to work with my LCD Monitor/TV. The connection on the computer is DVI and the connection on the Monitor is DVI. The Monitor says in the manual to hook up computers using the DVI connection. When I connect the too the monitor says there is no video input. I tried changing the settings on the monitor from PC mode to DVI mode and nothing. I have also tried changing the display on the computer to a couple of different settings and nothing. Please Help?

    Hi-
    A little more info please.
    What model G4?
    What Graphics card?
    What OS?
    What model/make of monitor?
    G4AGP(450)Sawtooth, 2ghz PowerLogix, 2gbRAM, RaptorSATAATA, ATI Radeon 9800   Mac OS X (10.4.8)   Pioneer DVR-109, 23" ACD, Ratoc USB 2.0, QCam Ultra, Nikon Coolscan

  • HT1848 I'm trying to sync my ipad mini with itunes and i get an error message '' there is no free space on your ipad mini''..... any ideas on how to empty some space on ipad mini manually? currently i run on 6.0.2

    I'm trying to sync my ipad mini with itunes and i get an error message '' there is no free space on your ipad mini''..... any ideas on how to empty some space on ipad mini manually? currently i run on 6.0.2

    iOS device backups are stored in your iTunes library.
    Move your iTunes library to an external drive.

  • HT1212 my i phone screen is black  i cannot access anything. i am trying to get my photos off of it and when i connect to i tunes it says my phone has a passcode which i cannot enter because my phone is black

    my i phone screen is black  i cannot access anything. i am trying to get my photos off of it and when i connect to i tunes it says my phone has a passcode which i cannot enter because my phone is black

    It's too late. If you had been syncing your phone with that computer prior to the screen failing, it wouldn't be asking you for a passcode...

  • Trying to make a purchase online with Skype and is telling me to contact you guys

    Trying to make a purchase online with Skype and is telling me to contact you guys

    We are fellow users here on these forums - if you are getting a message to contact iTunes Support then you can do so via this link and ask them for help : http://www.apple.com/support/itunes/contact/ , then click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • Problem connecting wirelessly from iMac to NETGEAR router, get invalid password message with WPA and WPA-2 encryption in place but if I remove them, so no security, can connect without a problem. Help!!

    Problem connecting wirelessly from iMac to NETGEAR router, get invalid password message with WPA and WPA-2 encryption in place but if I remove them, so no security, can connect without a problem. Help!!

    Thank you for your suggestion but I have already had a couple of phone sessions with NETGEAR support and they don't see any problems with the router settings etc. They referred me to Apple support, who helped me discover that it is possible to communicate with the router but only if I turn off the encryption/security software, which I don't want to do. The frustrating thing is that I can connect wirelessly from a laptop running Windows 7 and two Anroid smart phones, with WPA-2 in place, without a problem. Do you have any other ideas?

  • HT4437 The airplay on my i pad works with music and pictures but I cannot get it to work with safari and mirroring.  Does anyone know what I could be doing wrong? Thanks!!

    The airplay on my i pad works with music and pictures but I cannot get it to work with safari and mirroring.  Can someone help me to get things working?  Thanks!

    As an IT person, I can put my hands up to the same difficulty.  Then on double clicking on Home button, find AirTV symbol amongst Music control
    Solved my problem having spent hours looking for a complicated answer.  Well done Apple for hiding it so well.
    Brian

  • Itunes  11.4.0.18 crashing when clicking on app store  Itunes is getting crash when clicked on app store. I tried to get some information for this crash and got the above message in debugging mode. Please fix this if required but i am unable to open

    Itunes  11.4.0.18 crashing when clicking on app store
    Itunes is getting crash when clicked on app store. I tried to get some information for this crash and got the above message in debugging mode. Please fix this if required but i am unable to open app store.

    Click here and follow the instructions to change the iTunes Store country.
    (97125)

  • I am trying to get my apps on my iphone and when i click sync it says backing up files and it takes hours for it to go up but it says can't finish back up wat do i do

    i am trying to get my apps on my iphone and when i click sync it says backing up files and it takes hours for it to go up but it says can't finish back up wat do i do

    dplum12
    What computer operating system is your Premiere Elements 12 running on? Did you have the opportunity to update 12 to 12.1 Update yet using an opened project's Help Menu/Update? If not, please do so when you get the opportunity.
    For now I will assume that your computer is Windows 7, 8, or 8.1 64 bit. Please try the following suggestions to overcome your Premiere Elements Sign In issue.
    http://www.atr935.blogspot.com/2014/04/pe12-premiere-elements-12-editor-will.html
    and, if you get any messages about Internet connect and the computer clock, please review the following
    http://www.atr935.blogspot.com/2014/04/pe12-sign-in-failure-connect-to.html
    Please let us know the outcome.
    Thank you.
    ATR

  • How do I sync Google contacts.I've tried opening Address Book, clicking "sync with Google"  and clicking onSync icon. But no luck

    How do I sync Google contacts.I've tried opening Address Book, clicking "sync with Google"  and clicking Sync icon. But no luck

    just enable iCloud sync and then configure, setup and then disable it. Re-setup Google and it will work

  • I am trying to get an app for my iPad and I am getting an unknown error message

    I am trying to get an app for my iPad and I am getting an unknown error message.

    Without more information it's hard to help. You might want to start here:
    Using itunes on iPad: http://support.apple.com/kb/HT1491
    iTunes troubleshooting: http://www.apple.com/support/itunes/troubleshooting/

  • I am trying to get a free trial of Photoshop and when I try to run CreativeCloudSet-up nothing happens.

    I am trying to get a free trial of Photoshop and when I try to run CreativeCloudSet-up nothing happens. Can you please Help me so I can start using my free trial? How can I fix this?

    We can't know. You have not provided any system information or other technical details. If the setup doesn't even start, most likely your system doesn't meet the requirements.
    Mylenium

Maybe you are looking for