Multiple Oracle Cursors in a function

Hello folks.
We are componentizing a good chunk of data wrangling,
stuffing the random-ish queries and stored procedures in to CFCs.
However, many of the Oracle procedures return more than one cursor
(resultset). I am a bit shaky on CFCs in general I am afraid! The
question is how do I return both result sets when we can only have
one cfreturn tag per function?
I am probably missing something obvious, wouldn't be the
first time!

I got as far as putting a cursor and a single returned
variable in a structure, but ended up going a different direction
before trying 2 cursors. Hope this helps.

Similar Messages

  • Question about cursors in a function and how to return the results

    Hi all,
    Some tech info:
    I'm using Oracle 11G database and APEX 4.0.2.00.06
    I use three cursors in a function. My function is called in an APEX standard report, like this by example:
    SELECT fnc_exp(tab.arg1, tab,arg2) FROM table_exp tab;
    My question is: how can I return the values calculated from my function to a standard APEX report? Before, this function was used like this by Oracle Forms to fetch the cursors in the right table columns:
    open c_a;
    fetch c_a into :loc.arg1;
    close c_a;
    open c_b;
    fetch c_b into :loc.arg2, :loc.arg3, :loc.arg4, :loc.arg5;
    close c_b;
    Thanks for your advices!
    Maybe my solution is not right, if you have better ideas, please suggest :)
    PS: If you need more details, please ask which you need.

    Hi,
    I don't think you can do exactly like that in APEX.
    Go for a pipelined function if you want the value be returned from the function.

  • Multiple Oracle home

    Hi ,
    I have some doubt which needs to be cleared.
    If I will install multiple oracle home like ORACLE_HOME=/u01/app/oracle/product/10.1.0/asm
    ORACLE_HOME=/u01/app/oracle/product/9.2.0
    ORACLE_HOME=/u01/app/oracle/product/10.2.0
    ORACLE_HOME=/u01/app/oracle/product/crs
    Now in this when I will set export ORACLE_HOME then which version will be picked up.
    Is ORAENV isgoing to come into picture.
    Please throw some light on it.
    Mk

    asifkabirdba wrote:
    You have installed your oracle product (db,application server) using one of os user like oracle,appl,oraprod ect. When you log in to your OS by using OS user then .profile file executed automatically to export necessary environmental variables. You did not mention your OS. Normally you will find it to your OS user home directory. You can edit this file to set your desired ORACLE_HOME.
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
         . ~/.bashrc
    fi
    # User specific environment and startup programs
    PATH=$PATH:$HOME/bin
    export PATH
    unset USERNAME
    ORACLE_HOME=/oracle/product/102
    ORACLE_SID=ogtest
    LD_LIBRARY_PATH=$ORACLE_HOME/lib
    TNS_ADMIN=/oracle/product/102/network/admin/
    export ORACLE_HOME
    export ORACLE_SID
    export LD_LIBRARY_PATH
    export TNS_ADMIN
    export PATH=$PATH:$ORACLE_HOME/bin
    Regards
    Asif KabirAsif,
    Your advice to hard code the Oracle environment directly into the profile is poorly thought out. And a direct carry over of 'worst practices' unfortunately taught in some Oracle related classes.
    The OP did correctly identify oraenv (as described in the "Administrator's Reference for UNIX-Based Operating Systems" at http://www.oracle.com/pls/db102/portal.portal_db?selected=4) as the preferred solution. Putting THAT into the profile (using ORAENV_ASK as described in the manual) is OK.
    I'll leave you to figure out why the difference - I've posted many times about that in these forums.
    /Hans

  • Using Oracle CURSOR in SAP PI 7.0

    Hi All,
    I have a scenario in which I need to get the data from Oracle database using cursor, but I couldnu2019t find a direct method in PI to do the same using the JDBC sender channel.
    Can anyone tell me how we can access Oracle cursors in SAP PI?
    I have the work around like using temporary tables in the Oracle DB but I would like to know how we can use cursor
    I am using SAP PI 7.0 EHP 1
    Thanks in advanceu2026
    Regards,
    Manish Antony

    Hi Krish,
    I need to retrieve more than one record at a time and the oracle stored procedure cannot return more than one record like SQL server. The way to get more than one record from Oracle Stored procedure is through cursors.
    Also I may not be able to use standard query because I have a complex logic to retrieve the data (I need to get the data from multiple main tables and look up tables based on different conditions and also need to update the tables to avoid data duplication in the target system) which cannot be put in to the select and update statements in the communication channel.
    Regards,
    Manish Antony

  • PI 7.0 SP 11 support oracle cursor ?

    Hi
    Does PI 7.0 SP 11 support oracle cursor ? Because i need to send multiple rows data to oracle store procedure.
    Where do i have to search about the information how to call oracle store procedure with ref cursor input
    Regards
    Fernand

    Thank you Raj,
    I manage to calling store procedure with normal input (single), but then still got problem to supply data to store proc with input CURSOR.
    Base on link that you send me, i get this line out
    "CURSOR (output; only in conjunction with the Oracle JDBC driver)." is it meaning that JDBC adapter does not support CURSOR for input ? even SP 11 ?
    This is my sample oracle store procedure :
    CREATE OR REPLACE PACKAGE DB2_PAYSLIP IS
    CURSOR c_details IS SELECT '' in_nogaji               
              , '' in_jenis
              , '' in_no
              , '' in_deskripsi
              , '' in_jumlah          
         FROM DUAL;
    TYPE ct_details  IS REF CURSOR RETURN c_details%ROWTYPE;
    END;
    CREATE OR REPLACE PROCEDURE proc_ins_payslip(in_cur IN OUT db2_payslip.ct_details) IS
    v_in db2_payslip.c_details%ROWTYPE;
    BEGIN
          LOOP
                FETCH in_cur INTO v_in;
               INSERT INTO PAYSLIP_DETAIL VALUES(v_in.in_nogaji,v_in.in_jenis,v_in.in_no,v_in.in_deskripsi,v_in.in_jumlah);
               EXIT WHEN in_cur%NOTFOUND;
          END LOOP;
          CLOSE in_cur;
          COMMIT;
    END;
    Regards
    Fernand

  • Data Set with multiple ref cursors

    Hi ,
    I need to design an integrated report , i created my data set with a oracle procedure which returns "multiple ref cursors" . In this case birt is displaying all output columns together and it is difficult to identify which column belongs to which ref cursor and if there are any columns with same name in both output cursors , it displays only one. Is there any way to handle this ? or how we handle a data set which contains multiple ref cursors in output ??

    Having to ref cursors return mutiple recordsets in an Oracle package is like haveng two resultsets return from a MS SQL Server sparc.
    The link may point you in the right direction.
    http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram

  • BIP 11G - Retrieving a cursor from a function defined in a package

    We had previously deployed reports in OBIP 10G....
    The reports deployed in OBIP 10G used an XDO file to interact with the database and return data in XML format.
    This action used to be defined in the ‘sqlStatement’ tag of the XDO file.
    <dataQuery>
    <sqlStatement name="Q1"> select PK_AP_GEN_REP.AP_GEN_REP('AP_CH_R101',1) FROM DUAL </sqlStatement>
    </dataQuery>
    For this it would invoke our package called ‘PK_AP_GEN_REP’ and pass the report specific function name ('AP_CH_R101') to it as an input parameter.
    This returned a cursor.
    Hereafter the resultant cursor from above would get each column mapped with those mentioned in ‘dataStructure’ tags of XDO file to form an XML file.
    Currently we are trying the same in OBIP 11G.
    We are creating the dataset with SQL query
    The problem is that the SQL statement “select PK_AP_GEN_REP.AP_GEN_REP('AP_CH_R101',1) FROM DUAL” is not effective.
    Also if the above query is fired it does not retrieve the column names to define the data structure.
    Solutions tried:-
    1.     Forcefully defining the data-structure in XDM file created for this report. This did not work.
    2.     Firing a Before “Event Trigger”. This only works if the function is returning a Boolean and not a cursor.
    We tried modifying the function to return a Boolean and to populate the report specific table which could be queried to fetch the records.
    We defined Oracle DB Default Package = PK_AP_GEN_REP
    We defined the trigger as PK_AP_GEN_REP.AP_GEN_REP('AP_CH_R101',1)
    Now creating the dataset with SQL query does not return any data.
    It is giving the following error:-
    "XML document must have a top level element. Error processing resource 'http://iflmud5im00094:9704/xmlpserver/servlet/xdo'."
    However the query fires if Oracle DB Default Package is reset to nothing...But in this case the event trigger did not fire.
    If there is a wayout involving any of the above 2 steps or any other way please share the solution
    Kindly let me know how I may handle this issue of Retrieving a cursor from a function defined in a package in BIP 11g.

    Further regarding this....
    Not sure regarding performance issues of using pipelined functions
    Just to share with you that instead of what you suggested I have tried out returning a 'table' type object from a PL/SQL function after CAST ing the required query to this Object.
    Stretching the discussion forward, is there a way to cast a ref cursor into a plsql table.
    This could absolutely fit my requirement...
    Thanks in advance

  • Multiple Oracle home and multiple Oracle database versions on same server?

    Hi all,
    I want to setup a test environment on single Windows XP server with an instance
    of Oracle 10g and Oracle 11g. How can I install both versions without problems?
    Thanks

    Hi,
    I am facing a problem on the same..
    below is the link to my thread.
    Multiple Oracle Home in Windows
    Please reply me how to solve this problem
    Thanks
    Bhavik Fuletra

  • Multiple Oracle Products on Single Server

    Can we install Multiple Oracle Products for Development and Testing on a Single Server?
    Oracle Database 9i Enterprise Edition.
    Oracle 9i Application Server
    Oracle Applications 11i (Financials GL,HRMS PAYROLL)
    Oracle Discoverer 4.x
    Oracle Internet Developer Suite (Forms Server, Reports Server,
    If yes,
    Do they need to be in separate ORACLE_HOME or same ?
    Also what should be the sequence of Install, i.e. what should be installed first?

    The following products needs to be in their own Oracle Home:
    Oracle Database 9i Enterprise Edition. --> in its own O_H
    Oracle 9i Application Server --> in its own O_H (assuming this is 1.0.2.2 or 9.0.2)
    Oracle Applications 11i (Financials GL,HRMS PAYROLL) --> in its own O_H
    Oracle Discoverer 4.x --> in its own O_H (this is a 806 based product btw)
    Oracle Internet Developer Suite (Forms Server, Reports Server) --> This can either be in its own O_H or in the O_H which has 1.0.2.2 Oracle9i Application Server.

  • Passing contents of text file in oracle cursor

    Hi,
    I need to pass the content of text file in cursor and pass it on to calling codes. then calling codes will generate another text at their end. Can some help how can I pass contents of text file in oracle cursor? Thanks

    i need to do it without tables for some reasons.

  • Service Bus 12c Class not found 'oracle.tip.pc.services.functions.ExtFunc'

    Hi,
    Did anyone came across this issue with Class not being found for XSLT Function used in transformer on 12c OSB.
    I'm using oraext:sequence-next-val and have configured as below:
    namespace-uri:http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
    namespace-prefix: oraext
    Not sure why at runtime I'm getting below error, as the same was working fine in 11g OSB Domain.
    XML-22045: (Error) Extension function error: Class not found 'oracle.tip.pc.services.functions.ExtFunc'

    Have you restarted servers after putting jar in $Domain_Home/lib directory? Also try after explicitly adding this jar in classpath by editing server startup script (startManagedWeblogic.cmd or .sh) or in domain env setting script (setDonainEnv.cmd or .sh) and restarting the servers.
    Regards,
    Anuj
    Edited by: Anuj Dwivedi on Mar 21, 2011 1:10 PM

  • From IDOC to Multiple Oracle tables Structure

    Hi Guys,
    I am doing a one Senario which is Custom idoc and Custom Tables of oracle they both have same fields and Same Sturucte does it possible from to do 1:1 mapping shall i process these in 1:n.Need a sugestion in these  How i can slove these problem. IF some from india will give their cont pho to my mail id [email protected] i can call them and dicuss about these problem..
      the senario is idoc to multiple oracle tables..need to map.
    Regd's
    Raj

    Hi Raj,
    you scenario can be:
    R/3 -> XI -> JDBC
    The flow is asynchronous - so you dont have any responses. If you want to use BPM/acknowledgements to catch errors have a look to <a href="/people/udo.martens/blog/2005/09/30/one-logical-system-name-for-serveral-bpm-acknowledgements Logical System Name for serveral BPM Acknowledgements</a>
    You can split the IDoc (<a href="/people/jin.shin/blog/2006/02/07/multi-mapping-without-bpm--yes-it146s-possible without BPM - Yes, it’s possible!</a>) to several JDBC messages or put serveral statements into one message (
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm">Document Formats for the Receiver JDBC Adapter</a>)
    Regards,
    Udo

  • Multiple Oracle Homes

    Hi everybody,
    I have Oracle 9i installed on my Windows machine.
    I installed Oracle Developer Suite, but could not login due to TNS errors.
    I have a little idea of what the problem is. We need to edit TNSNAMES.ORA file so that it could resolve the service name.
    Can u please help me out in configuring Developer Suite to work properly?
    Thanks.
    -- Kishore.

    Not quite sure why your title is Multiple Oracle Homes. Can you connect to SQLPLUS or any other product in the suite? Is it just Designer you are having hassles with? Do you have the database on the same machine and can you connect to that? If you are successful at connecting to SQLPLUS, then take a look at the tnsnames file in the Database network /admin directories.
    There was a bug at one point where the tnsnames would fail if the network connect string was between 184 and 192 characters in length. You may be running into this. In which case if your tnsnames.ora contains
    (CONNECT_DATA =(SID = <SID>), you can change this to use (CONNECT_DATA =(SERVICE_NAME= <SID>)
    Regards
    Sue

  • Guidelines regarding directory structure for multiple Oracle homes on Unix!

    Hi All,
    Are there any guidelines published regarding directory structures that should be defined while using multiple Oracle homes on Unix/Linux box?
    I am looking for guidelines regarding admin and oradata folders so that we dont accidentally mess up with the DB contents with a wrong Oracle home.
    Its a development server with 8i and 10g. 11g might also get loaded on the same server in future.
    Thanks in advance...
    Regards

    Thanks Maran.
    I have already checked many installation guides before posting here. All of them mention about creating folders like /admin or /oradata on various mount points but none of the naming conventions really indicate whether it is a 8i database or a 10g database.
    This is required when you are having multiple Oracle installations under /opt and databases are running from different mount points.
    Regards,

  • Multiple OracleAS installs

    We are creating a shared services environment where we plan to install multiple OracleAS. We don't want the different organizations to have to access URLs containing ports.
    Is there a way to make this work?
    For example:
    Install 1 Listens on port 7777, 443 and we added 80. The url for this OracleAS is https://xyz.org
    Install 2 Listens on port 7778, 4443. We want url for this OracleAS to be https://abc.org

    Good point, I overlooked the point that you wanted to install both of these on the same machine.
    Yes you are right that the default ports that browsers don't require to be specified are 443 and 80. As you said those are used by other install so yes you will not be able to bypass it just with OHS.
    I guess in this situation you will either have to have either a software/hardware load balancer or a proxy server to front end these two OHSs. And there you define a rule to redirect to respective OHS based on requested URL.
    You can have another (third) installation of OHS and configure it as the proxy for other OHSs. You can configure this third OHS to run on port 443 and 80 and other two OHSs on different ports.
    You can also use Oracle Web Cache product (which can act as a reverse proxy/software load balancer). There you can create two sites (of desired external facing URLs with proper DNS settings so those URLs are resolvable) and define a site-to-server mapping for each site pointing to respective origin server (OHS).
    Hope this will help.
    Thanks
    Shail

Maybe you are looking for