Dynamic call for a ref cursor: ORA-21779

Hi,
Here is an environment:
create or replace
PACKAGE PKG_GETDATA AS
TYPE cursor_type IS REF CURSOR;
Procedure SimpleGet (cData In Out Cursor_type);
Procedure DynamicGet (cData In Out Cursor_type);
END PKG_GETDATA;
create or replace
PACKAGE BODY "PKG_GETDATA" AS
Procedure SimpleGet (cData In Out Cursor_type) As
Begin
Open cData For
Select 1 from Dual;
End SimpleGet;
Procedure DynamicGet (cData In Out Cursor_type) As
Begin
Execute Immediate 'Begin PKG_GETDATA.SIMPLEGET(:1); End;'
Using In Out cData;
End DynamicGet;
END PKG_GETDATA;
So- first simple get works fine:
Declare
cData PKG_GETDATA.Cursor_type;
aNumber Number;
Begin
PKG_GETDATA.SimpleGet (cData);
LOOP
FETCH cData INTO aNumber;
EXIT WHEN cData%ROWCOUNT > 5 OR cData%NOTFOUND;
dbms_output.put_line (aNumber);
END LOOP;
close cData;
End;
BUT dynamic call does not works at all!:
Declare
cData PKG_GETDATA.Cursor_type;
aNumber Number;
Begin
PKG_GETDATA.DynamicGet (cData);
LOOP
FETCH cData INTO aNumber;
EXIT WHEN cData%ROWCOUNT > 5 OR cData%NOTFOUND;
dbms_output.put_line (aNumber);
END LOOP;
close cData;
End;
It throws ORA-21779 exception; what is more- it does work on 10.2 db version but does not work on 11.2 version! Could anyone explain that?
Regards
Bartlomiej D.

Hi,
Believe me, it may be very handful while working with handlers.
Anyway- could anyone help me on that?
Regards
Bartlomiej D.

Similar Messages

  • Unit Test Validation for Output Ref Cursor Not Working

    Here is the problem:
    I have a stored procedure as follows:
    CREATE OR REPLACE
    PROCEDURE usp_GetEmployee(
    p_employeeId IN NUMBER,
    cv_employee OUT Sys_RefCursor )
    AS
    BEGIN
    OPEN cv_employee FOR SELECT * FROM employees WHERE employee_id=p_employeeid;
    END usp_GetEmployee;
    For this, I am implementing a unit test.
    * In the "Select Parameters" step, I am unchecking the "Test Result" check box for the cursor OUT variable.
    * In the "Specify Validations" step, I am choosing "Boolean Function" and putting the following PL/SQL code:
    DECLARE
    emp_rec {cv_employee$}%rowtype;
    BEGIN
    FETCH {cv_employee$} INTO emp_rec;
    IF {cv_employee$}%FOUND THEN
    RETURN TRUE;
    ELSE
    RETURN FALSE;
    END IF;
    RETURN TRUE;
    END;
    But, when I try to execute this Test, I get the following error:
    Validation Boolean function failed: Unable to convert <oracle.jdbc.driver.OracleResultSetImpl@4f0617> to REF CURSOR.
    If I run in the debug mode, I get the following content in a dialog box:
    The following procedure was run.
    Execution Call
    BEGIN
    "ARCADMIN"."USP_GETEMPLOYEE"(P_EMPLOYEEID=>:1,
    CV_EMPLOYEE=>:2);
    END;
    Bind variables used
    :1 NUMBER IN 1001
    :2 REF CURSOR OUT (null)
    Execution Results
    ERROR
    CV_EMPLOYEE : Expected: [Any value because apply check was cleared], Received: [EMPLOYEE_ID                             COMMISSION_PCT                          SALARY                                 
    1001                                    0.2                                     8400                                   
    Validation Boolean function failed: Unable to convert <oracle.jdbc.driver.OracleResultSetImpl@31dba0> to REF CURSOR.
    Please suggest how to handle this issue.
    Thanks,
    Rahul

    979635 wrote:
    But, when I try to execute this Test, I get the following error:
    Validation Boolean function failed: Unable to convert <oracle.jdbc.driver.OracleResultSetImpl@4f0617> to REF CURSOR.
    If I run in the debug mode, I get the following content in a dialog box:
    The following procedure was run.
    Execution Call
    BEGIN
    "ARCADMIN"."USP_GETEMPLOYEE"(P_EMPLOYEEID=>:1,
    CV_EMPLOYEE=>:2);
    END;
    Bind variables used
    :1 NUMBER IN 1001
    :2 REF CURSOR OUT (null)
    Try explicity declaring the ref cursor instead of using a bind variable, something like (untested)
    begin
      foo sys_refcurosr;
    begin
      test_procedure(foo);
    end;Alternately, in SQL*PLUS use the DEFINE command to ste a named bind variable to type REFCURSOR and use the named bind variable in your test
    Edited by: riedelme on Jan 23, 2013 7:10 AM

  • Is there a different way to open a cursor for a ref cursor procedure?

    hello everybody
    i have two cursors, cur_a and cur_b, declared somewhere else in my application.
    These two cursors have the same fields, in the same order, and i have to treat both in the same way. So i wrote a routine that gets as input a ref cursor based on the cur_a rowtype, and i am trying to use this routine for both.
    The problem is that i am not able to open outside the routine the cursor in a different way than usual...
    the common method is :
    declare curs ref cursor ...
    begin
    open curs for (select *...)
    end;
    instead i would like to obtain something different
    declare curs ref cursor ...
    begin
    open curs for cur_a
    end;

    hi
    thanks for answering
    i wanted just to give a better idea, anyway you were near to get it.
    the only difference is that the two cursors are not written in dynamic sql, just like strings, but are real cursors.
    anyway, this is the version of the package i need, but i am not able to compile
    (your original code is commented and immediately below there is my code)
    CREATE OR REPLACE PACKAGE BODY mytest
    IS
    --cur_a VARCHAR2(200) := 'SELECT dummy FROM DUAL';
    CURSOR cur_a
    IS
    SELECT dummy
    FROM DUAL;
    --cur_b VARCHAR2(200) := 'SELECT ''fred'' FROM DUAL';
    CURSOR cur_b
    IS
    SELECT 'fred' fred
    FROM DUAL;
    TYPE t_cur_a IS REF CURSOR
    RETURN cur_a%ROWTYPE
    --PROCEDURE routine_a_b (p_cur SYS_REFCURSOR) IS
    PROCEDURE routine_a_b (p_cur t_cur_a)
    IS
    v_x VARCHAR2 (10);
    BEGIN
    LOOP
    FETCH p_cur
    INTO v_x;
    EXIT WHEN p_cur%NOTFOUND;
    DBMS_OUTPUT.put_line (v_x);
    END LOOP;
    END;
    PROCEDURE doit
    IS
    --v_curs SYS_REFCURSOR;
    v_curs t_cur_a;
    BEGIN
    NULL;
    -- open v_curs FOR cur_a;
    OPEN v_curs FOR cur_a;
    routine_a_b (v_curs);
    CLOSE v_curs;
    -- open v_curs FOR cur_b;
    -- routine_a_b(v_curs);
    -- close v_curs;
    END;
    END;
    the error is:
    cursor 'V_CURS' cannot be used in dynamic SQL OPEN statement
    i did read that if use weak ref cursor, it could work, so i declare the ref cursor type in this way:
    TYPE t_cur_a IS REF CURSOR;
    instead than
    TYPE t_cur_a IS REF CURSOR
    RETURN cur_a%ROWTYPE
    what i get is another error (in the open cursor command)
    PLS-00382: expression is of wrong type....
    but if i replace
    OPEN v_curs FOR cur_a;
    with
    OPEN v_curs for select dummy from dual;
    it works... but i already knew it.. :-)
    anyway, i used a work around to resolve it, so it's just philosophy

  • Dynamic call for records in a table

    hI,
    Im having a ztable, the structure is as follows:
    tabold fldold tabnew fldnew
    The records in this table is are:
    1.yvbap  posnr xvbap posnr
    2.yvbak  auart xvbak auart
    3.yvbak  augru xvbak augru.
    Now, i have to use this table dynamically to check each and every record in the program:mv45afzz.
    So, my problem is that, i have to dynamically pass these records which contains table name and its field name.
    i can write as: xvbap-posnr = yvbap-posnr for all the three records (the values will come from sales order tranx, report: mv45afzz)
    but in future if the records are added then i have to again change the code, so this shouldn't happen.
    It should dynamically call all the records in this table and check the condition.
    Thanx
    Rohith

    Hello Rohith
    What is your question???
    You described a few ingredients of your scenario (not all of them) and do not really explain your requirements.
    Given the descriptions of the Z-table fields I assume you need to check whether OLD values are equal to NEW values.
    If this assumption is correct then the solution is quite simple (except for XVBAP / YVBAP: Does this mean single entries or looping over all entries?)
    DATA:
      lt_ztable     TYPE STANDARD TABLE OF zstructure,
      ls_ztable     TYPE zstructure.
      FIELD-SYMBOLS:
        <lt_tab>     TYPE table,
        <ls_struct_old>    TYPE any,
        <ls_struct_new>   TYPE any,
        <ld_old>    TYPE any,
       <ld_new>    TYPE any.
    " Read entries from z-table
      SELECT * FROM ztable INTO table lt_ztable.
      LOOP AT lt_ztable INTO ls_ztable.
        ASSIGN (ls_ztable-tabold) TO <ls_struct_old>.
        ASSIGN (ls_ztable-tabnew) TO <ls_struct_new>.
        ASSIGN COMPONENT (ls_ztable-fldold) OF STRUCTURE <ls_struct_old> TO <ld_old>.
        ASSIGN COMPONENT (ls_ztable-fldnew) OF STRUCTURE <ls_struct_new> TO <ld_new>.
        IF ( <ld_old> = <ld_new> ).
          " do something...
        ENDIF.
      ENDLOOP.
    For the sake of simplicity I did not add the required statements for checking successful ASSIGN's.
    Regards
      Uwe

  • How to include an out param of a stored proc called inside a ref cursor...????

    I have a stored proc that is defined as
    CREATE or REPLACE
    PROCEDURE ABC
    (linkid IN CHAR,
    Year_in IN DATE,
    Method_in IN CHAR,
    Date_out OUT DATE,
    average_out OUT NUMBER)
    is
    begin
    end;
    another partially completed stored proc that returns a ref
    cursor defined as follows:
    create or replace package zzz
    as
    type cursorType is ref cursor;
    end;
    create or replace function test return zzz.cursortype
    as
    date_OUT date;
    Average_OUT number;
    l_cursor zzz.cursorType;
    CURSOR temp_cur is
    SELECT l.linkid, L.routenumber, ABC(l.linkid,
    to_date('01/01/2000', 'mm/dd/yyyy'),
    '2',
    date_OUT,
    average_OUT)
    FROM LINK l
    WHERE l.LINKID <= '010999';
    begin
    open temp_cur;
    end;
    inside test (which I need help completing), how can I refer to
    the date_out and the average_out params returned by ABC() so
    that these values are in turn passed to the cursortype defined
    in package zzz?
    Thanks in advance.

    Try rewriting your abc proceudre as two functions, abc1 and
    abc2, and rewriting your test function as a test procedure. See
    if you can fill in the blanks prefaced by hyphens -- in the
    following code:
    CREATE OR REPLACE FUNCTION abc1
      (linkid      IN  CHAR,
       year_in     IN  DATE,
       method_in   IN  CHAR)
      RETURN DATE
    IS
      date_out DATE;
    BEGIN
      SELECT   --
      INTO     date_out
      FROM     --
      WHERE    --;
      --or
      date_out := --;
      RETURN date_out;
    END abc1;
    CREATE OR REPLACE FUNCTION abc2
      (linkid      IN  CHAR,
       year_in     IN  DATE,
       method_in   IN  CHAR)
      RETURN NUMBER
    IS
      average_out NUMBER;
    BEGIN
      SELECT   AVG (--)
      INTO     average_out
      FROM     --
      WHERE    --
      GROUP BY --;
      --or
      average_out := --;
      RETURN average_out;
    END abc2;
    CREATE OR REPLACE PACKAGE zzz
    AS
      TYPE cursortype IS REF CURSOR;
      PROCEDURE test
        (temp_cur OUT cursortype);
    END zzz;
    CREATE OR REPLACE PACKAGE BODY zzz
    AS
      PROCEDURE test
        (temp_cur OUT cursortype)
      IS
      BEGIN
        OPEN temp_cur
        FOR
        SELECT l.linkid,
               l.routenumber,
               abc1 (l.linkid,
                    TO_DATE ('01/01/2000', 'mm/dd/yyyy'),
                    '2'),
               abc2 (l.linkid,
                    TO_DATE ('01/01/2000', 'mm/dd/yyyy'),
                    '2')
        FROM   link l
        WHERE  l.linkid <= '010999';
      END test;
    END zzz;
    SQL> VARIABLE g_ref REFCURSOR;
    SQL> EXEC zzz.test (:g_ref);
    SQL> PRINT g_ref

  • Function call returned in ref cursor

    We have a ref cursor that calls a function in a package. When ODP.NET reads the cursor, it can't see what the function is returning. OO4O works fine, and if I take the sql that populates the ref cursor and put it into a temporary table, then select from that temporary table to return the ref cursor to ODP, it works fine. Anyone else seen this issue? Any help would be appreciated. Thanks.
    Eric Schrauth
    [email protected]

    Did you set the parameter direction to be ParameterDirection.Input when you created the parameter? Post your code.

  • How to use dynamic values for service-ref

    service-ref element allows for static configuration for endpoint reference as follows:
    <copy>
    <from>
    <literal>
    <sref:service-ref xmlns:sref="http://docs.oasis-open.org/wsbpel/2.0/serviceref">
    <EndpointReference xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
    <Address>http://localhost:8080/mockservice</Address>
    </EndpointReference>
    </sref:service-ref>
    </literal>
    </from>
    <to>$serviceref</to>
    </copy>
    I want to change the address value dynamically in service-ref element. How can I achieve it ?

    Hi,
    Why don't you try:
    1. Bpel references
    You can select a BPEL reference property in your composite.xml and use it within your bpel process. This is explained here:
    http://orasoa.blogspot.co.uk/2009/08/soa-11g-preferences.html
    Then you can create a deployment configuration plan. Right-click on the composite file and generate a deployment configuration plan for your composite. This should create a search/replace construction for your preference.
    2. DVM (Data Value Maps)
    You can populate the address by using dvm lookup function. Create a DVM file with two columns, one to specify the Address/URL and populate the other column with the actual value. Use the address as your unique lookup criteria to retrieve the value. This value can be configured per environment.
    Hope this helps.
    Thanks
    Sander

  • Dynamic call for ADOBE FORMS

    Hi ,
    I want to call Adobe forms with dynamic table .
    Some one please explain me how I can implement this in ADOBE interface ?
    Any Pointers or Help higly appreciated.
    Thanks
    James

    hi
    Check this
    Difference between Smart Forms and Adobe Form
    Re: Smart Forms & Adobe Forms
    Adobe forms
    /message/4983958#4983958 [original link is broken]
    Re: adobe forms
    adobe forms
    adobe forms
    adobe forms

  • REF CURSOR problem .. function call from select

    Hello,
    I am still on the search for a way to call a function from with in a select statement.
    I've done it in SQL*Plus like this and it works.
    SELECT name, f_format(name) FROM user WHERE id = 12;
    This returns first the unformatted (raw) version of the stored value for name and then the formmtted version of the stored value of name.
    Since multiple names will be returned I need to user a REF CURSOR (cursor variable). The above select statement does not work from within the OPEN . .FOR clause necessary for a REF CURSOR.
    What can I do instead? My goal is to return multiple records of formatted names.
    null

    I have declared the reference cursor as a weak one. Thank you for clarifying that though. I was wondering if it made a difference. Here is a simple package that shows you what I am trying to do. I will include the errors at the bottom. Please have a look and let me know what you think is wrong.
    /*--------- PL/SQL ------------*/
    CREATE OR REPLACE PACKAGE test_refcur AS
    PROCEDURE decrypt (
    i_string IN VARCHAR2
    ,o_string OUT VARCHAR2
    TYPE PwdCurTyp IS REF CURSOR;
    PROCEDURE get_pwd_info (
    i_user_id IN NUMBER
    ,io_pwd_cv IN OUT PwdCurTyp
    END test_refcur;
    CREATE OR REPLACE PACKAGE BODY test_refcur AS
    FUNCTION f_decrypt (
    i_string IN VARCHAR2
    ) RETURN VARCHAR2 IS
    l_string VARCHAR2(64);
    l_string_dec VARCHAR2(32);
    BEGIN
    l_string := i_string;
    dbms_obfuscation_toolkit.DESDecrypt(
    input_string => l_string
    ,key_string =>'12345678'
    ,decrypted_string=> l_string_dec );
    RETURN l_string_dec;
    END f_decrypt;
    PROCEDURE decrypt (
    i_string IN VARCHAR2
    ,o_string OUT VARCHAR2
    ) IS
    BEGIN
    o_string := f_decrypt(i_string);
    END decrypt;
    PROCEDURE get_pwd_info (
    i_user_id IN NUMBER
    ,io_pwd_cv IN OUT PwdCurTyp
    ) IS
    BEGIN
    OPEN io_pwd_cv FOR
    SELECT
    label
    ,f_decrypt(user_name_text) AS dec_user_name
    ,f_decrypt(text) AS dec_pwd
    FROM
    code_pwd
    WHERE
    id = i_user_id;
    END get_pwd_info;
    END test_refcur;
    /*--------- SQL*Plus -----------*/
    Warning: Package Body created with compilation errors.
    SHOW ERRORSErrors for PACKAGE BODY TEST_REFCUR:
    LINE/COL ERROR
    28/13 PL/SQL: SQL Statement ignored
    30/18 PLS-00231: function 'F_DECRYPT' may not be used in SQL
    Then I made the SELECT statement dynamic.
    OPEN io_pwd_cv FOR
    'SELECT label, f_decrypt(user_name_text) AS dec_user_name, f_decrypt(text) AS dec_pwd FROM code_pwd WHERE id = i_user_id';
    It compiled fine.
    Package body created.
    So then I tried to do the following. .
    SET AUTOPRINT ON
    SET SERVEROUTPUT ON
    VARIABLE cv REFCURSOR
    EXECUTE test_refcur.get_pwd_info(18, :cv)begin test_refcur.get_pwd_info(18, :cv); end;
    ERROR at line 1:
    ORA-00904: invalid column name
    ORA-06512: at "K.TEST_REFCUR", line 27
    ORA-06512: at line 1
    If I change the SELECT statement to the following, this is what I get. .
    OPEN io_pwd_cv FOR
    SELECT label
    -- ,f_decrypt(user_name_text) AS dec_user_name
    -- ,f_decrypt(text) AS dec_pwd
    FROM code_pwd
    WHERE id = i_user_id;
    SET AUTOPRINT ON
    SET SERVEROUTPUT ON
    VARIABLE cv REFCURSOR
    EXECUTE test_refcur.get_pwd_info(18, :cv)PL/SQL procedure successfully completed.
    LABEL
    Development Server
    That tells me that at least something is working. How can I get everything else to work?

  • Ref cursor and dynamic sql

    Hi..
    I'm using a ref cursor query to fetch data for a report and works just fine. However i need to use dynamic sql in the query because the columns used in the where condition and for some calculations may change dynamically according to user input from the form that launches the report..
    Ideally the query should look like this:
    select
    a,b,c
    from table
    where :x = something
    and :y = something
    and (abs(:x/:y........)
    The user should be able to switch between :x and :y
    Is there a way to embed dynamic sql in a ref cursor query in Reports 6i?
    Reports 6i
    Forms 6i
    Windows 2000 PRO

    Hello Nicola,
    You can parameterize your ref cursor by putting the query's select statement in a procedure/function (defined in your report, or in the database), and populating it based on arguments accepted by the procedure.
    For example, the following procedure accepts a strongly typed ref cursor and populates it with emp table data based on the value of the 'mydept' input parameter:
    Procedure emp_refcursor(emp_data IN OUT emp_rc, mydept number) as
    Begin
    -- Open emp_data for select all columns from emp where deptno = mydept;
    Open emp_data for select * from emp where deptno = mydept;
    End;
    This procedure/function can then be called from the ref cursor query program unit defined in your report's data model, to return the filled ref cursor to Reports.
    Thanks,
    The Oracle Reports Team.

  • Calling stored proc from java using ref cursor

    Hi All,
    We have a requirement to display all the records from a table on a JAVA screen. Due to some constraints, we have to write the query in the stored proc. We are trying to return a result set from the stored proc to the java code by using a ref cursor. Please refer to the code below.
    Following is the PL/SQL proc �
    procedure sp_user_course2(v1 OUT ref_cursor, persid in varchar2) as
    begin
    open v1 for
    SELECT lrn_exp_id, crs_name FROM emp_crs
    WHERE personid = persid;
    end;
    Here ref_cursor is of TYPE REF CURSOR declared in the package specification.
    The java code is �
    Callable stmt = conn.prepareCall("call sp_user_course2(?,?)");
    stmt.registerOutParameter(1,OracleTypes.CURSOR);
    stmt.setString(2,emplId);
    stmt.execute();
    OracleCallableStatement tstmt = (OracleCallableStatement) stmt;
    ResultSet rs = tstmt.getCursor (1);
    When I run the program, I get the following error (at stmt.execute()):
    [Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'SP_USER_COURSE2' 6553
    Can anyone tell me what could be the problem with this code? I have read somewhere that REF CURSOR feature is available from Oracle 9i onwards. If so, then, is there any workaround for mapping REF CURSOR to Resultsets in Oracle 8i?

    These may help
    http://www.google.co.uk/search?q=jdbc+OracleTypes.CURSOR+tutorial

  • Calling stored proc from java to return ref cursor

    Hi All,
    We have a requirement to display all the records from a table on a JAVA screen. Due to some constraints, we have to write the query in the stored proc. We are trying to return a result set from the stored proc to the java code by using a ref cursor. Please refer to the code below.
    Following is the PL/SQL proc ?
    procedure sp_user_course2(v1 OUT ref_cursor, persid in varchar2) as
    begin
    open v1 for
    SELECT lrn_exp_id, crs_name FROM emp_crs
    WHERE personid = persid;
    end;
    Here ref_cursor is of TYPE REF CURSOR declared in the package specification.
    The java code is ?
    Callable stmt = conn.prepareCall("call sp_user_course2(?,?)");
    stmt.registerOutParameter(1,OracleTypes.CURSOR);
    stmt.setString(2,emplId);
    stmt.execute();
    OracleCallableStatement tstmt = (OracleCallableStatement) stmt;
    ResultSet rs = tstmt.getCursor (1);
    When I run the program, I get the following error (at stmt.execute()):
    [Oracle][ODBC][Ora]ORA-06553: PLS-306: wrong number or types of arguments in call to 'SP_USER_COURSE2' 6553
    Can anyone tell me what could be the problem with this code? I have read somewhere that REF CURSOR feature is available from Oracle 9i onwards. If so, then, is there any workaround for mapping REF CURSOR to Resultsets in Oracle 8i?

    These may help
    http://www.google.co.uk/search?q=jdbc+OracleTypes.CURSOR+tutorial

  • Dynamic queries in report builder 6i ( ref cursor query )

    Hi everyone,
    My requirement is that I want to create a report where the query is dynamic. The dynamic part will be known at runtime as it is being passed via a parameter. My query looks like this :
    select * from emp where sal :p1 :p2
    Possible values for :p1 are - '>', '<', '>=', '<=', '=', '!='
    Possible values for :p2 are - any value entered by the user
    I tried creating a query in report builder based on a ref cursor. But it does not allow me to create the query for the ref cursor dynamically. That means I have to hardcode the query in the program.
    I tried using place holder columns without success.
    Can someone please help me ?
    Regards,
    Al

    Hi,
    You can use lexical paramters in the sql query
    x - char - parameter
    select * from emp &x
    you need to pass the value for x in the parameter as
    'where sal < 1234'.
    Note : Lexical variable should be of char datatype.
    This is an alternative to the ref cursors.
    This works. Hope this is clear.

  • Iterate thru ref cursor received from Procudure

    Hi All,
    I have a proc X that has an Out parameter as ref cursor.
    I am calling that proc in another proc Y now how do i iterate through the ref Cursor returned.(in which data type shall i fetch the record of that ref cursor)
    Regards
    Arpit

    Arpit wrote:
    I have a proc X that has an Out parameter as ref cursor.
    I am calling that proc in another proc Y now how do i iterate through the ref Cursor returned.(in which data type shall i fetch the record of that ref cursor)The "data type" (known as the SQL projection) of the ref cursor depends on the SQL statement executed. That can be totally dynamic and unknown for a ref cursor until run-time - which means there is no way for your static PL/SQL code to know what the projection is and how to fetch it.
    Which is why ref cursors are VERY SELDOM used in PL/SQL..
    Ref cursors are intended to be consumed by external Oracle client processes - not PL/SQL. A DBMS_SQL cursor is to PL/SQL what a ref cursor is to an external client.
    Consuming ref cursors in PL/SQL code is unusual - and should be treated as an exception. And this asks the question what are your reasons for writing PL/SQL code that consumes a ref cursor?

  • Adding ability to use ref cursors in future versions of Apex

    Currently it has been documented that Apex does not play well with ref cursors and how to get around that. Is this a feature that the Apex team is looking into for future versions? Currently we are using Oracle 11g and 1 g with Apex 4.0.2. Your reply is most appreciated.
    JudJasRis

    Hi Tony Miller,
    Thank you for the prompt reply. I see your name in many of the replies in this Apex forum.
    We currently have several package functions that use out ref cursors. We are looking to use the result of that ref cursor for our reports. We have found a way to get around the ref cursor by creating a table collection of the row type and return it in a specific function declaration in a pipelined function. I am fairly new to creating pkgs, functions and specifically pipeline functions as well as learning the many nooks and crannies of Apex. It would be nice to be able to call a predefined ref cursor within Apex. I was just curious if that was a feature that could be developed. Please excuse my lack of knowledge, I am learning though by asking these type of questions.
    Again thank you.
    JudJasRis

Maybe you are looking for