Using more than one sysrefcursors in a procedure.

Hi,
can we use 2 -3 sysrefcursors to get 3 different resultset out from a single plsql procedure for particular page on front end? each sysrefcursor with with different select?
I have to fetch resultset and fire a query for searching data, finding aggregate on few fields and one more query for finding aggregates.
can we do this?
Could you please reply this with simple example?
Thanks a lot.

>
can we use 2 -3 sysrefcursors to get 3 different resultset out from a single plsql procedure for particular page on front end? each sysrefcursor with with different select?
I have to fetch resultset and fire a query for searching data, finding aggregate on few fields and one more query for finding aggregates.
can we do this?
Could you please reply this with simple example?
>
You can pretty use as many as you like. Just define them as OUT parameters (or IN OUT) and open them all before the procedure returns.
I've seen 50 used in one procedure at a large financial institution. Of course they had performance problems related to that.
Keep in mind that every cursor you open causes Oracle to perform ALL of the parsing and read consistency work needed to service ALL of the cursors. So if you open three cursors but the user only uses one of them the work for the other two is wasted and can contribute to performance issues.
Here is an example using one cursor. You can add more to expand the example.
CREATE OR REPLACE TYPE SCOTT.local_type IS OBJECT (
    empno   NUMBER(4),
    ename   VARCHAR2(10));
CREATE OR REPLACE TYPE SCOTT.local_tab_type IS TABLE OF local_type;
CREATE OR REPLACE PACKAGE SCOTT.test_refcursor_pkg
AS
    TYPE my_ref_cursor IS REF CURSOR;
     -- add more cursors as OUT parameters
     PROCEDURE   test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor);
END test_refcursor_pkg;
CREATE OR REPLACE PACKAGE BODY SCOTT.test_refcursor_pkg
AS
     PROCEDURE  test_proc(p_ref_cur_out OUT test_refcursor_pkg.my_ref_cursor)
     AS
        l_recs local_tab_type;
     BEGIN
         -- Get the records to modify individually.
         SELECT local_type(empno, ename) BULK COLLECT INTO l_recs
         FROM EMP;
         -- Perform some complex calculation for each row.
         FOR i IN l_recs.FIRST .. l_recs.LAST
         LOOP
             DBMS_OUTPUT.PUT_LINE(l_recs(i).ename);
         END LOOP;
         -- Put the modified records back into the ref cursor for output.  
         OPEN p_ref_cur_out FOR
         SELECT * from TABLE(l_recs);      
         -- open more ref cursors here before returning
     END test_proc;
END;
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
  l_cursor  test_refcursor_pkg.my_ref_cursor;
  l_ename   emp.ename%TYPE;
  l_empno   emp.empno%TYPE;
BEGIN
  test_refcursor_pkg.test_proc (l_cursor);
  LOOP
    FETCH l_cursor
    INTO  l_empno, l_ename;
    EXIT WHEN l_cursor%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(l_ename || ' | ' || l_empno);
  END LOOP;
  CLOSE l_cursor;
END;
/

Similar Messages

  • How to use more than one application server during initial load?

    Hi,
    we plan to use more than one application server in CRM during initial download in order to increase the number of parallel requests and to decrease the time for the initial load. Is there a way to allocate requests to more than one server? Is is possible via multiple rfc connections for consumer CRM in CRMRFCPAR?
    Thanks.
    Alexander Schiffer

    Hi Naresh,
    thanks for your answer. It has solved my problem. SMLG is the transaction that I was looking for.
    Two more OSS notes that helped me to guide our basis into the right direction:
    OSS 593058 - New RFC load balancing procedure
    OSS 1413986 - SMLG: Possibility to select a favorite type for Ext.RFCs
    Thanks again.
    Alexander Schiffer

  • Use more than one DB in InfiniteInsight

    Hi,
    I want to know if is it possible to use more than one Data Base for create a Data Source in InfiniteInsgiht and how.
    Thank you very much.

    Hi Daniel and Edouard,
    I would first like to clarify one point: SAP InfiniteInsight can read data from the database directly.
    If your data are in a table or view, you can select the option "Use a File or a Database Table".
    With this same option, you can also enter a SQL query in "Data Set" :
    Now, as Edouard mentioned, you can also use Explorer to create a more complex dataset for your analysis.
    Technically, you will need to enter either one database connection or file as input for your different analyses. That being said, if you need to access 2 databases, (let's call them A and B) there is a way.
    It's called heterogeneous database system. You have to configure your database A to enable an access to database B.
    SAP InfiniteInsight will be connected to A which has access to B. Thus, you will be able to use data from 2 different databases. 
    I am unfortunately no a database specialist, I am not sure all DB enable this and the procedures might be complex.
    Hope this helps,
    Armelle

  • How can I use more than one Data Provider in my web Apps

    I am trying to use two different data provider in my web apps to run two different queries from the same table ,the data provider A is working correctly but when I attempt to run data provider B ,It display an error page ,here is the error message : Exception Details :javax.servlet.ServletEx ception
    java.lang.RuntimeException: java.sql.SQLException : Cannot connect .Both dataSourceName and url properties are null.

    Hi,
    You can use more than one data provider in your application. However if you have defined a dataprovider for a particular table already, and wish to bind a component, select the component and use its context menu to Bind to Data...

  • Can I use more than one Apple ID on one device

    I have seen some answers to this type of question before but not that since the ios 6 so will ask again. My household shares an Apple ID and it has worked great as we have added devices and purchased apps.  My problem now is this, we have hit a point where I have work things on my iPad and iPhone that I really don't need to be shared with the whole family but it isn't a major deal or security risk. I don't want to give up the advantages of having the household ID.  Is there an easy way to have another ID on my iPad and switch between them without having major complications?  I am for the most part a techie so not afraid of these kind of things but I can't afford to lose everything right now and take the time to set it all back up so getting advice here.  Thanks in advance for any help you can give.

    You can use more than one apple id, but keep in mind that when apps need updating that you'll will need to sign in with correct credentials to update them.
    Share an apple id for the itunes and app stores, but keep your own for icloud, facetime and messages.
    Managing and Sharing multiple id's with your family
    http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/

  • Can we use more than one Help Provider class in a same project in ADF11g

    Hi All,
    There are two help providers i want to use .They are "ResourceBundleHelpProvider","OHW Help Provider"
    In adf-settings.xml file
    <help-provider>
    <help-provider-class>oracle.adf.view.rich.help.ResourceBundleHelpProvider</help-provider-class>
    <property>
    <property-name>baseName</property-name>
    <value>com.symmetry.dashboard.panels.Help</value>
    </property>
    </help-provider>
    if try to register both help providers confliction occurs. Is it possible to register and use more than one help provider.?
    Thanks in advance.:)

    Thanks Frank,
    In adf-settings.xml file
    <help-provider>
    <help-provider-class>oracle.adf.view.rich.help.ResourceBundleHelpProvider</help-provider-class>
    <property>
    <property-name>baseName</property-name>
    <value>com.symmetry.dashboard.panels.Help</value>
    </property>
    </help-provider>
    <help-provider prefix="RB_">
    <help-provider-class>oracle.help.web.rich.helpProvider.OHWHelpProvider</help-provider-class>
    <property>
    <property-name>ohwConfigFileURL</property-name>
    <value>/myHelpset/config.xml</value>
    </property>
    <property>
    <property-name>baseURI</property-name>
    <value>http://127.0.0.1:7101/Dashboard_workflow/myHelpset/%3c/value>
    </property>
    </help-provider>
    I differentiated the help providers with the "prefix" attribute in the <help-provider> tag. So now confliction is not occuring between those.
    I used this prefix in the "helpTopicId" property of the adf components like "input text box" . I got the result. :)

  • Can I use more than one song in a slideshow?

    Can I use more than one song in a slideshow?  If so, how?  Thank you

    Dear Barbara B. 
    Thank you for your response.  Good idea about combining the songs in another program first.
    Thank you for your time and thoughts.

  • Can I use more than one SIM card in my iPhone if I buy it SIM free?

    Can I use more than one SIM card in my iPhone if I buy it SIM free?

    Sim free is not enough, you can use different sim if it's unlock.

  • Can I use more than one Apple ID for an Apple TV?

    I wanted to use more than one Apple ID account on my Apple TV, is that possible?

    Welcome to the Apple Community.
    You can only use one ID for purchasing from the Apple TV, but you can stream content from multiple libraries even though they have different ID's

  • Can u use more than one apple account on your device and itunes

    Can u use more than one apple account on your device and itunes

    Yes, but you have to logout of one, and login to the other.
    If it is an iPhone/iPad/iPod Touch and you buy apps on different accounts, when it comes time to update an app, you have to specify the password for the account used to acquirer the app. You change an iOS account via Settings -> Store -> Apple ID (tap on it), and start by logging out and then you can enter the other Id
    So it is possible, but it can also be a pain.

  • Can I use more than one iTunes account with my apple TV?

    Can I use more than one iTunes account with my apple TV?

    That depends what you mean. If you mean can you purchase from more than one iTunes account on the Apple TV, then the answer is no. If you mean can you stream from more than one iTunes library, which use different accounts, then the answer is yes, so long as they both use the same ID and password for homesharing.

  • I keep my library on an external hard drive 4TB.  It's full.  Can I use more than one hard drive to keep my library on?

    I keep my iTunes library on an external hard drive 4TB.  It's full.  Can I use more than one hard drive to keep my library on? Like two 4TB next to each other.

    Create a concatenated disk set
    Increase storage space with a concatenated RAID set (also called “Just a Bunch of Disks” or JBOD). If you need one large disk, but you have only several smaller disks, you can create a concatenated disk set to use several small disks as one large disk.
    Open Disk Utility, in the Utilities folder in Launchpad.
    Select one of the disks that you want in the set, and then click RAID.
    Click Add (+), and type a name for the RAID set.
    Choose a format from the Format pop-up menu. Usually you’ll choose the Mac OS Extended (Journaled) format.
    Choose Concatenated Disk Set from the RAID Type pop-up menu.
    Drag the disks you want to add to the set to the list on the right.
    Click Create.
    Exerpt from:
    Disk Utility 12.x: Create a RAID set - Apple - Support
    Note that the biggest CON to concatenated RAID configurations is vulnerability to volume failure. If either disk fails, the whole volume fails. If you choose this option, I would highly recommend backing up your music to a cloud service. There are very cheap per GB/storage, and some of the most reputable actually offer unlimited storage:
    Five Best Cloud Storage Providers - Lifehacker

  • Can I use more than one midi keyboard?

    I'm curious If I can run more than one midi application, is this possible?

    SuitcaseRecordings wrote:
    Can I use more than one midi keyboard?
    In Logic, yes.
    I'm curious If I can run more than one midi application, is this possible?
    Yes. you have to set up the Midi, pslit it up between the applications. e.g. channels 1-8 to app 1, and channels 9-16 to app 2.
    Then select the channels according to what application you want to play.
    "My spoon has run dry now..."
    Cheers

  • Can I use more than one transition when creating a slideshow in IDVD

    I want to use more than one transition in IDVD when creating a slideshow, is this possible?

    Not so. Under Windows select Photos.
    That will show the Media Browser in the lower right hand corner of iMovie.
    Use the File ➙ New Project to create a new project.  Select the photos from iPhoto you want to create a movie from and drag into the new project area.
    From there add your transitions, music, etc.

  • Can I use more than one database connections in a jdeveloper project?

    I use jdeveloper version 9.0.4.0 (build 1407),Can I use more than one database connections in one jdeveloper project?

    9.0.4 is a fairly old version, so you may only find a few people who know how it worked.
    Assuming you're using ADF BC, once known as BC4J, once know as JBO, in the project, and that the architecture hasn't changed much, then the answer is only 1 connection per project.
    Programmatically you're free to use as many connections via JEE as you see fit, but ADF BC is limited to one connection.
    CM.

Maybe you are looking for