How can I catch a resultset thrown out by PL/SQL procedure or function.

hi,
I want to write a program in java which receives a resultset
from PL/SQL , how can I do that.
I don't want to create the resultset by passing a simple sql
statement, I want the sql statement to be executed in the
procedure or function,
which in turn returns a PL/SQL table of records, or refcursor,
and capture it in the resultset.

Here's a quick note on how I do it:
1. RETURN a REF CURSOR from your PL/SQL function.
2. In your Java program, you declare the return type from the
Statement as OracleTypes.CURSOR.
/* Prepare your PL/SQL function call here */
CallableStatement mystatement = myconnection.prepareCall
( "BEGIN ? := myfunction( p_param => ? ); END;" );
/* Register the Oracle REF CURSOR as the return type */
mystatement.registerOutParameter(1, OracleTypes.CURSOR);
/* Set any additional input parameters to your function */
mystatement.setString(2, "Param value");
3. When you fetch the cursor from your Statement, do getObject
() and then cast the Object as a ResultSet e.g.:
mystatement.execute);
ResultSet rs = (ResultSet) mystatement.getObject(1);
/* Now you can iterate through the ResultSet in the same way as
for any other JDBC ResultSet */
while (rset.next())
/* Fetch the values from your REF CURSOR here */
mystatement.close();
There may be better ways to do this, but it works for me.
Regards,
Chris I've put in a few more details above. Sorry I can't copy in a
whole chunk of code for you, but this should be enough to get
you started. I would recommend the Wrox Press book on
application programming with Oracle 8i, as it includes lots of
examples of many different tools for Oracle 8i e.g. JDBC, EJB,
BC4J, Portal, XML etc.
Good luck,
Chris

Similar Messages

  • How can I Catch the program to prevent exit all?

    Hi,
    I am actually implementing a Ptolemy GUI for my subject. And I am now facing a very serious problem. I build an application to call the Ptolemy application to probe up a plotting graph program. Every time after I call the run Simulation() the program call the plotting from Ptolemy, but when I press close from the plotting, everything close including all applications that are not expected to close.
    The problem I think is located here:
    PtolemyApplication exec_model = new PtolemyApplication(argument);
    So I would like to know how can I catch its exit to avoid closing everything.
    Can anyone give me suggestion please?
    below are the method I call:
    public void runSimulation()
    try{
    File file = new File("default.xml");
    DataOutputStream out =
    new DataOutputStream(new FileOutputStream(file));
    SimGraphWriter writer = new SimGraphWriter();
    boolean checkAllConnected;
    checkAllConnected = writer.write(graphpane.getGraphModel(),
    graphpane.getGraphView(),currDirector, out);
    if(checkAllConnected){
    ("//d/Ptolemyii/ptII0.4/ptII0.4beta/bin/ptolemy.bat ./default.xml");
                   String argument[] = {"default.xml"};
                   try {
                        PtolemyApplication exec_model =
    new PtolemyApplication(argument);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        this.dispose();
                   catch(Exception ex) {
                        System.out.println(ex);
                        ex.printStackTrace();
    catch(Exception ex){
              System.out.println(ex);
    ex.printStackTrace();
    }

    Thread is an object that u create just like String /or whatever eg;-
    Thread firstThread, secondThread, thirdThread;
    once they're declared u can stop, start + run them individually with boolean values (true /false) and therefore control what u want to do when.
    Play with the code examples + mess around with it - it's not absolute beginner stuff - but it isn't that tough either

  • How can I extract a km-iView out the portal to redefine it?

    Hello folks,
    I want to redefine the com.sap.km.cm.navigation-iView to serve generic access to the users home drive by using the <User.UserID>-variable. Therefore I have to extract/download the iView out of the Portal. I wasn't able to find KM-Content in Systemadministration->Support->Portal Runtime->Browse Deployment. What do I have to do?
    How can I extract a km-iView out the portal to redefine it?
    Regards
    Steffen

    Just as an example:
    package com.btexx.proxy;
    import com.sapportals.portal.prt.component.*;
    import com.sapportals.portal.prt.pom.IEvent;
    import com.sapportals.wcm.repository.ResourceException;
    import com.sapportals.wcm.repository.ResourceFactory;
    import com.sapportals.wcm.service.IServiceTypesConst;
    import com.sapportals.wcm.service.urlgenerator.IURLGenerator;
    public class Example extends AbstractPortalComponent
         protected void doOnNodeReady(IPortalComponentRequest request, IEvent event){
              String uname = request.getUser().getLogonUid();
              String path = "/userhome/"+uname;
              String rndLayoutSet = "ConsumerExplorer";
              String explorerServletPath = "/irj/servlet/prt/portal/prtroot/com.sap.km.cm.navigation";
                   try {
                        IURLGenerator ug = (IURLGenerator) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
                        explorerServletPath = ug.getExplorerServletPath();
                   } catch (ResourceException e) {
              request.redirect(explorerServletPath+path+"?rndLayoutSet="+rndLayoutSet);
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    + portalapp.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="usermanagement, knowledgemanagement"/>
      </application-config>
         <components>
              <component name="Example">
         <component-config>
              <property name="ClassName" value="com.btexx.proxy.Example"/>
              </component-config>
                   <component-profile>
                        <property name="com.sap.portal.reserved.iview.Redirect" value= "true"/>
                   </component-profile>
              </component>
         </components>
    <services/>
    </application>
    all the best,
    dimitry

  • I purchased an ablum thru itunes on my phone and it says i purchased the songs on itunes but when i go on my music it says i have to repurchase all the songs how can i get the songs with out havin to pay again

    I purchased an ablum thru itunes on my phone and it says i purchased the songs on itunes but when i go on my music it says i have to repurchase all the songs how can i get the songs with out havin to pay again

    Whether you can redownload music depends upon what country that you in. If you are using your computer's iTunes then does music show in the Purchased link under Quicklinks on the right-hand side of the iTunes store home page (on your phone you might be able to redownload media via the Purchased tab in the iTunes store app) ? If music shows there, but not that album, then check to see if it's hidden : http://support.apple.com/kb/HT4919
    If you aren't in a country when you can redownload music and it's still on your phone then you should be able to copy it over from the phone via File > Devices > Transfer Purchases.

  • How can I get 300 dpi tifs out of webex stills & then worked on in adobe illustrator?

    How can I get 300 dpi tifs out of webex stills & then worked on in adobe illustrator?
    I have been trying to convert images created in webex and transferred to illustrator into 300 dpi tifs. They download as ucf's when generated on white board. Or I have to upload files from other webex participants coming in at 72 dpi, converting them to something bigger in photoshop to paint in before taking them back into the webex session as a doc that then gets worked on further during the session. Later they go into illustrator for some more work with vectors. That's fine for the web but now a publisher wants them as 300 dpi tifs and I can only get things back & forth as 72 dpi pdf's. If I try to bump them up with a resample, they come out teensy weensy. What am I missing and is there any way to make them look good?

    What I need is to be able to transfer the images between formats without degradation of the resolution and find ways to sharpen what I have even if I can't increase pixels. If the original I'm delivered is a 96 dpi power point slide, for example, that's what I have to work with, I'm using Illustrator to compensate with vectors. But then I still need to get it back to a 300 dpi tiff to meet the specs.

  • How can i catch the jsp checking event ?

    As we know, there are three parameters which is about checking in the weblogic.xml, pageCheckSeconds,*servlet-reload-check-secs*,*resource-reload-check-secs*, but how can i catch the checking event when the webapp is active.
    The fellowing is my simple test, i deployed a webapp on a weblogic server instance, and it was actived. I wrote a simple bash shell to try to catch the event, but fail. i througnt it may be dependent on the webapp's stage mode. but i change the mode, and try again, it was fail too.
    [weblogic@tdy218 ~]$ ls
    getLastAccessTime.sh webapps
    [weblogic@tdy218 ~]$ ./getLastAccessTime.sh ~/webapps/Test/login.jsp
    The file's last access time is: 2011-05-22 11:10:21.000000000 +0800
    The file's last access time is: 2011-05-22 11:10:21.000000000 +0800
    The file's last access time is: 2011-05-22 11:10:21.000000000 +0800
    The file's last access time is: 2011-05-22 11:10:21.000000000 +0800
    The file's last access time is: 2011-05-22 11:10:21.000000000 +0800
    The file's last access time is: 2011-05-22 11:10:21.000000000 +0800
    The file's last access time is: 2011-05-22 11:10:21.000000000 +0800
    [weblogic@tdy218 ~]$ ./getLastAccessTime.sh
    /bea/wls924/user_projects/domains/base_domain/servers/AdminServer/stage/Test/Test/login.jsp
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    The file's last access time is: 2011-05-22 11:11:37.000000000 +0800
    [weblogic@tdy218 ~]$ stat
    /bea/wls924/user_projects/domains/base_domain/servers/AdminServer/stage/Test/Test/login.jsp
    File: `/bea/wls924/user_projects/domains/base_domain/servers/AdminServer/stage/Test/Test/login.jsp'
    Size: 634 Blocks: 8 IO Block: 4096 regular file
    Device: 804h/2052d Inode: 583725 Links: 1
    Access: (0644/-rw-r--r--) Uid: ( 502/weblogic) Gid: ( 500/ bea)
    Access: 2011-05-22 11:11:37.000000000 +0800
    Modify: 2010-05-24 14:49:08.000000000 +0800
    Change: 2011-05-22 11:10:21.000000000 +0800
    The jsp file's last access time didn't changed in the past.
    [weblogic@tdy218 ~]$ more getLastAccessTime.sh
    #!/bin/bash
    declare -i m=1
    declare -i n=100
    while [ $m -le $n ]; do
    echo "The file's last access time is: $(stat -c %x $1)"
    m=m+1
    sleep 3
    done
    weblogic.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.oracle.com/technology/weblogic/servers/wls810/dtd/weblogic810-web-jar.dtd">
    <weblogic-web-app>
    <jsp-descriptor>
    <jsp-param>
    <param-name>pageCheckSeconds</param-name>
    <param-value>2</param-value>
    </jsp-param>
    </jsp-descriptor>
    <container-descriptor>
    <servlet-reload-check-secs>2</servlet-reload-check-secs>
    <resource-reload-check-secs>2</resource-reload-check-secs>
    </container-descriptor>
    <context-root>/jdbc</context-root>
    </weblogic-web-app>
    env :
    WebLogic 9.2 MP4、Redhat Linux AS 4 Update 8 x86.

    I tested on WLS 11g ps2(10.3.3) which is running in Development Mode also, but it was the same as WLS 9.2 MP4.
    During the weblogic server running, it don't check the application resources , but it will check the $Domain_Home/autodeploy directory every three seconds in Development Mode , the following is the result.
    [weblogic@tdy218 ~]$ ./getLastAccessTime.sh /bea/wls924/user_projects/domains/base_domain/autodeploy
    The file's last access time is: 2011-05-22 12:01:43.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:43.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:43.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:46.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:46.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:46.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:49.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:49.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:49.000000000 +0800
    The file's last access time is: 2011-05-22 12:01:52.000000000 +0800
    Ctrl + ^
    [weblogic@tdy218 ~]$ ./getLastAccessTime.sh ~/webapps/Test
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    The file's last access time is: 2011-05-22 17:26:25.000000000 +0800
    Ctrl + ^
    [weblogic@tdy218 ~]$ ./getLastAccessTime.sh ~/webapps/Test/
    insert.jsp login.jsp query.jsp tdy218.sql WEB-INF/
    [weblogic@tdy218 ~]$ ./getLastAccessTime.sh ~/webapps/Test/login.jsp
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    The file's last access time is: 2011-05-22 11:44:31.000000000 +0800
    Ctrl + ^
    I set the frequency to every one seconds this time by using sleep method in my Bash Shell script.
    #!/bin/bash
    declare -i m=1
    declare -i n=100
    while [ $m -le $n ]; do
    echo "The file's last access time is: $(stat -c %x $1)"
    m=m+1
    sleep 1
    done

  • How can I deploy only one package out of a big project?

    Does any one know how can I only deploy one package out of a big project?
    We have a project which includes about 12 differenct packages. Is there a way in Jdeveloper for me to create a deploy profile to only deploy one package to a *.jar file?
    Do I have to re-create a new project ( that's what I am doing currently) simply for deployment purpose?
    By the way, click and pick class from more than 100 classes is too much of work. In addition, you don't really know exactly which class you are picking if two classes (in different packages) have the same name.
    Thanks a lot.

    Rename your LCA file extention into .ZIP
    Open the ZIP file in any of the compressing utility (e.g. WinZip, WinRar etc.)
    Extract the desired process and deploy it manually to your server.
    Nith

  • HT201269 my pc crashed and i no longer have the music i used to have, how can i sync my ipod  w/ out loosing  all of my  music.  and also how do i update  my ipod only has  a partial version of ios4

    My pc crashed and i no longer have the music i used to have, how can i sync my ipod  w/ out loosing  all of my  music.  and also how do i update  my ipod only has  a partial version of ios4

    It has always been very basic to always maintain a backup copy of your computer for this very occasion.  USe your backup copy to put everything on the new computer, then sync.

  • I am using i 4 phone. recently I had a problem with my lap top and had formatted hard disk of it. Now I want to use sync data in my iphone back to itune n my lap top. how can I perform this task with out loosing data in my i phone.

    I am using i 4 phone. recently I had a problem with my lap top and had formatted hard disk of it. Now I want to sync data in my iphone back to itune on my lap top. how can I perform this task with out loosing data in my i phone.

    Hey floridiansue,
    Do you have an installed email program such as Microsoft Outlook?  If your email is through an online login, such as Gmail, etc, then one will have to create an email association with a program such as Microsoft Outlook on the PC for this Scan to Email system to function.
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------
    I am not an HP employee.

  • In Aperture 3, how can I easily move entire projects out of my main Ap Library into other libraries?  My Ap library is running super slow because it's overloaded l so I have created two new libraries, but can't seem to move the projects into them

    In Aperture 3, how can I easily move entire projects out of my main Ap Library into other libraries?  My Ap library is running super slow because it's overloaded, so I have created two new libraries, but can't seem to move the projects into them?

    Hello Annabel,
    To move entire projects export them as Aperture Libraries, and then import those Libraries into the other Aperture Library:
    Select the Project in the Inspector, then
    File -> Export -> Project as Library
    In the other Library do:
    File -> Import  -> Library/ Project
    But I am not quite convinced, that the size of your current Aperture Library is responsible for the slowness of Aperture - Aperture is designed to cope with huge libraries.
    You may want to post your hardware setup and details of your library, and some of the hardware experts here may help you to find the reason for the slowness.
    A huge library should only be a problem, if the projects are too big, and if you have many, many smart albums at the root level of your library.
    So keep the projects small, and try to move some of your smart albums to lower levels in your folder structure (then Aperture does not need to scan all of your images to build the smart album).
    Other reasons for Aperture's slowness may be, e.g.
    An overfull system drive and/or external drive (keep at least 20% of your drives empty)
    lack of RAM
    a corrupted Aperture Library, that needs repairing
    Have you checked those options, before you split your library? It would be a pity to split it, for you would loose the ability to browse all parts at the same time, to use all your images in the Media Browser, etc.
    Regards
    Léonie

  • How can I catch and display the "cent" symbol (Alt+0162)?

    Hi,
    I have a jTextArea field in which it supposes to be able to catch a special
    character, money cent symbol by Alt+0162 from the keyboard. Does anyone know
    how I can catch it and display it in money cent symbol in the jTextArea field?
    Thanks for your help.
    -John

    The CATCH-ENDCATCH statement is obsolete as of release was620. You should use TRY. CATCH. ENDCATCH.
    The exception that will be raise is CX_SY_CONVERSION_NO_NUMBER, so you have to catch that exception or a super class of this exception class.
    REPORT zfsl_sum_functions.
    DATA: cin(50),
    cout(50),
    iin TYPE i,
    iout TYPE i,
    etext TYPE string.
    DATA: rf_cx_error TYPE REF TO CX_SY_CONVERSION_NO_NUMBER,
            errortxt TYPE string.
    TRY.
        cin = '123ABC'. " how can i catch this
        iout = cin.
        WRITE: iout.
      CATCH CX_SY_CONVERSION_NO_NUMBER INTO  rf_cx_error.
        errortxt = rf_cx_error->get_text( ).
        WRITE errortxt.
    ENDTRY.

  • How can I get a stripped screw out of the bottom of my iPhone?? I need help, How can I get a stripped screw out of the bottom of my iPhone?? I need help

    How can I get a stripped screw out of the bottom of my iPhone?? I need help, How can I get a stripped screw out of the bottom of my iPhone?? I need help

    Try asking at ifixit.com. The iPhone is not considered user servicable. You're not going to get much help on an Apple sponsored forum.

  • How can i get a iphone 3G out of recovery mode without restoring it

    Need Help, How can I get a iPhone 3G out of recovery mode without restoring it. it has never been backed up so restoring it will loose all contacts etc.

    You can't get it out of recovery mode without restoring it. 
    If it's in recovery mode, your data's almost certainly gone anyway.

  • How can I catch the exception type c = type i?

    How can I catch the exception and display the error message when I assign the u2018ABC123u2019 value to an int data type.
    Code is as follow.
    REPORT  zfsl_sum_functions.
    DATA: cin(50),
          cout(50),
          iin TYPE i,
          iout TYPE i,
          etext TYPE string.
    cin = '123ABC'.     " how can i catch this
    iout = cin.
    WRITE: iout.

    The CATCH-ENDCATCH statement is obsolete as of release was620. You should use TRY. CATCH. ENDCATCH.
    The exception that will be raise is CX_SY_CONVERSION_NO_NUMBER, so you have to catch that exception or a super class of this exception class.
    REPORT zfsl_sum_functions.
    DATA: cin(50),
    cout(50),
    iin TYPE i,
    iout TYPE i,
    etext TYPE string.
    DATA: rf_cx_error TYPE REF TO CX_SY_CONVERSION_NO_NUMBER,
            errortxt TYPE string.
    TRY.
        cin = '123ABC'. " how can i catch this
        iout = cin.
        WRITE: iout.
      CATCH CX_SY_CONVERSION_NO_NUMBER INTO  rf_cx_error.
        errortxt = rf_cx_error->get_text( ).
        WRITE errortxt.
    ENDTRY.

  • How can i download photoshop cs5 with out a cd

    how can i download photoshop cs5 with out a cd

    This link should get you going: https://helpx.adobe.com/x-productkb/global/find-serial-number.html
    Benjamin

Maybe you are looking for