Problem in ref cursor

Experts,
Any idea to fix the below error?
" not all variables bound"
Below procedure is successfully created, but thrown above error msg while executing.
When I run the 'stmt1' separately, it runs perfect.
But as a procedure throwing error.
create or replace procedure applys(Id varchar2, Seq varchar2, SId varchar2) is
cursor c1 is select * from meta_applys;
crec1 c1%rowtype;
stmt1 varchar2(400);
stmt2 varchar2(400);
stmt3 varchar2(400);
rc1 sys_refcursor;
gkey number(20);
ckey varchar2(15);
begin
     open c1;
     loop
     fetch c1 into crec1;
     exit when c1%notfound;
     stmt1:='select g_key, c_key from '||crec1.t_name||' where Id = :1 and Seq = :2 and '||crec1.dbcname||' not in
     (select '||crec1.vw_colname||' from '||crec1.v_name||' where SId = :3)';
          execute immediate stmt1 into gkey, ckey;
          dbms_output.put_line(gkey||ckey);
     end loop;
     close c1;
     commit;
end;
I'm taking 2 values from ref cursor & assigning to 2 variables declared.
Then why is that error occurring?
Please assist.

Experts,
actually I missed to supply the column names for 'using ' in the below code extract.
stmt1:='select g_key, c_key from '||crec1.t_name||' where Id = :1 and Seq = :2 and '||crec1.dbcname||' not in
(select '||crec1.vw_colname||' from '||crec1.v_name||' where SId = :3)';
execute immediate stmt1 using Id, Seq, SId into gkey, ckey;
However even after rectifying that(like above), it's not getting executed.
I'm digging more to fix.

Similar Messages

  • Problem passing REF CURSOR to JAVA STORED PROCEDURE

    Hi,
    I've written a small Java class with a static method and
    imported that into Oracle 8i. The method expects a
    java.sql.ResultSet object as parameter. According to the
    documentation of Oracle, a REF CURSOR (cursor variable) maps to
    java.sql.ResultSet in JDBC.
    The definition of the Java Stored Procedure was accepted without
    problems:
    CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
    WASTypes.GenericCurType)
    as language java
    name 'sqlj.ResultSetPassingTest.testResultSetPassing
    (java.sql.ResultSet)';
    WASTypes is a package containing the definition of the generic
    cursor:
    CREATE OR REPLACE PACKAGE WASTYPES
    is
    TYPE GenericCurType IS REF CURSOR;
    END WASTypes;
    In a function I'm opening the cursor via
    'Open cursorVariable for sqlStatement';
    Then this cursor variable is passed to the java method and the
    error ORA-03113 is shown.
    I tried to solve the problem by changing the type of the
    parameter to oracle.sql.REF without success.
    Does anybody know what wents wrong?
    Thanks in advance.
    Jan

    Hi,
    I've written a small Java class with a static method and
    imported that into Oracle 8i. The method expects a
    java.sql.ResultSet object as parameter. According to the
    documentation of Oracle, a REF CURSOR (cursor variable) maps to
    java.sql.ResultSet in JDBC.
    The definition of the Java Stored Procedure was accepted without
    problems:
    CREATE OR REPLACE PROCEDURE RESULTSETPASSINGTESTPROC (row
    WASTypes.GenericCurType)
    as language java
    name 'sqlj.ResultSetPassingTest.testResultSetPassing
    (java.sql.ResultSet)';
    WASTypes is a package containing the definition of the generic
    cursor:
    CREATE OR REPLACE PACKAGE WASTYPES
    is
    TYPE GenericCurType IS REF CURSOR;
    END WASTypes;
    In a function I'm opening the cursor via
    'Open cursorVariable for sqlStatement';
    Then this cursor variable is passed to the java method and the
    error ORA-03113 is shown.
    I tried to solve the problem by changing the type of the
    parameter to oracle.sql.REF without success.
    Does anybody know what wents wrong?
    Thanks in advance.
    Jan

  • Problem using REF CURSOR in JDBC

    i have several stored procedures and functions that return REF CURSOR object as output. however, i'm noticing that if
    no rows are returned within the cursor, the JDBC driver is throwing a "No more data to read from socket" exception.
    i'm using the Oracle Thin JDBC driver v8.1.6 for JDK 1.2.
    any help is appreciated.
    thanks,
    gary
    null

    I am not able to reproduce the problem. Could you post a testcase so that we can follow it up?
    Thanks.

  • Iteration problem in ref cursor

    hi all
    declare
    type ref_cur is ref cursor;
    p_ref_cur ref_cur;
    type namelist is table of varchar2(10);
    type address is table of varchar2(20);
    p_namelist namelist;
    p_address address;
    begin
    open p_ref_cur for 'select emp_code,EMP_ADDR from emp_det_bak';
    fetch p_ref_cur bulk collect into p_namelist,p_address;
    for i in p_ref_cur
    loop
    dbms_output.put_line('this is for testing '||p_ref_cur(i));
    end loop;
    end;
    i found error like following--
    ERROR at line 11:
    ORA-06550: line 11, column 10:
    PLS-00221: 'P_REF_CUR' is not a procedure or is undefined
    ORA-06550: line 11, column 1:
    PL/SQL: Statement ignored
    if i use
    for i in p_ref_cur.first..p_ref_cur.last
    i got error message like --
    Invalid reference to variable 'P_REF_CUR'
    can anyone pls tell me what wrong i'm doing and if i want to iterate through will i use
    like--while(p_ref_cur.next) loop
    please suggest me.
    Message was edited by:
    p.bhaskar

    > please suggest me.
    Well, there is a fairly easy way to create a refcursor with the ability to loop through the columns of the cursor - without knowing what the columns are.
    However, this is not always an ideal approach. It uses VARCHAR2 as the data type for all columns and requires the source SQL to to construct a collection.
    Here's a brief example of this approach:
    SQL> create or replace type TColumns as table of varchar2(4000);
    2 /
    Type created.
    SQL>
    SQL> create or replace procedure DisplaySQL( sqlStatement varchar2 ) is
    2 c SYS_REFCURSOR;
    3 colList TColumns;
    4 rowCnt integer := 0;
    5 begin
    6 open c for sqlStatement;
    7
    8 loop
    9 fetch c into colList;
    10 exit when c%NOTFOUND;
    11
    12 rowCnt := rowCnt + 1;
    13
    14 W( '****************' ); -- W = DBMS_OUTPUT.put_line
    15 W( 'row: '||rowCnt );
    16 W( 'columns: '||colList.Count );
    17
    18 for i in 1..colList.Count
    19 loop
    20 W( 'column='||i||' value='||colList(i) );
    21 end loop;
    22 end loop;
    23
    24 W( '****************' );
    25 close c;
    26 end;
    27 /
    Procedure created.
    SQL>
    SQL>
    SQL> var SQL varchar2(4000);
    SQL>
    SQL> exec :SQL := 'select TColumns(created, object_type, object_name) from ALL_OBJECTS where rownum = 1';
    PL/SQL procedure successfully completed.
    SQL> exec DisplaySQL( :SQL )
    row: 1
    columns: 3
    column=1 value=2005/07/21 19:04:20
    column=2 value=TABLE
    column=3 value=CON$
    PL/SQL procedure successfully completed.
    SQL>
    SQL> exec :SQL := 'select TColumns(created, object_type, object_name) from
    ALL_OBJECTS where rownum = 1 UNION ALL select TColumns(dummy,SYSDATE) from
    DUAL';
    PL/SQL procedure successfully completed.
    SQL> exec DisplaySQL( :SQL )
    row: 1
    columns: 3
    column=1 value=2005/07/21 19:04:20
    column=2 value=TABLE
    column=3 value=CON$
    row: 2
    columns: 2
    column=1 value=X
    column=2 value=2007/05/16 13:14:56
    PL/SQL procedure successfully completed.
    SQL>

  • Problem in ref cursor output..plz suggest changes

    SQL> select * from department;
        DEPTNO ENAME
         7124284 SINGH
    SQL> CREATE OR REPLACE PACKAGE l_ref_cursor
      2  AS
      3  TYPE rc IS REF CURSOR;
      4  END;
      5  /
    Package created.
    SQL> CREATE OR REPLACE PROCEDURE P_RET_REF_CURSOR(in_deptno IN NUMBER,lrc OUT l_ref_cursor.rc)
      2  AS
      3  BEGIN
      4  OPEN lrc FOR 'SELECT * FROM DEPARTMENT WHERE DEPTNO='||in_deptno;
      5  END;
      6  /
    Procedure created.
    SQL> DECLARE
      2  TYPE DEPT_REF_CURSOR IS REF CURSOR RETURN DEPARTMENT%ROWTYPE;
      3  C1 DEPT_REF_CURSOR;
      4  R_C1 C1%ROWTYPE;
      5  BEGIN
      6  EXECUTE IMMEDIATE 'BEGIN P_RET_REF_CURSOR(:A,:C); END;'
      7  USING IN 7123864,
      8  OUT C1;
      9  LOOP
    10  FETCH C1 INTO R_C1;
    11  EXIT WHEN C1%NOTFOUND;
    12  DBMS_OUTPUT.PUT_LINE(R_C1.ENAME);
    13  END LOOP;
    14  END;
    15  /
    DECLARE
    ERROR at line 1:
    ORA-03113: end-of-file on communication channelCould some one correct me, and also elucidate on what's wrong in my piece of code?
    Thanks,
    Bhagat

    The worse part is that it happens in 9.2.0.5.0 even..
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production
    PL/SQL Release 9.2.0.7.0 - Production
    CORE    9.2.0.7.0       Production
    TNS for Linux: Version 9.2.0.7.0 - Production
    NLSRTL Version 9.2.0.7.0 - Production
    SQL> select * from department;
        DEPTNO ENAME
       7124284 SINGH
    SQL> CREATE OR REPLACE PACKAGE l_ref_cursor 
      2  AS 
      3   TYPE rc IS REF CURSOR; 
      4  END;
      5  /
    Package created.
    SQL> CREATE OR REPLACE PROCEDURE P_RET_REF_CURSOR(in_deptno IN NUMBER,lrc OUT l_ref_cursor.rc)  
      2  AS 
      3  BEGIN 
      4   OPEN lrc FOR 'SELECT * FROM DEPARTMENT WHERE DEPTNO= :1' USING in_deptno; 
      5  END; 
      6  /
    Procedure created.
    SQL> DECLARE 
      2 
      3  TYPE DEPT_REF_CURSOR IS REF CURSOR RETURN DEPARTMENT%ROWTYPE; 
      4 
      5  C1 DEPT_REF_CURSOR; 
      6  R_C1 C1%ROWTYPE; 
      7  BEGIN 
      8 
      9  EXECUTE IMMEDIATE 'BEGIN P_RET_REF_CURSOR(:A,:C); END;'  USING IN 10, OUT C1; 
    10 
    11  LOOP FETCH C1 INTO R_C1;
    12  EXIT WHEN C1%NOTFOUND;
    13  DBMS_OUTPUT.PUT_LINE(R_C1.ENAME);
    14  END LOOP;
    15  END;
    16  /
    ERROR:
    ORA-03114: not connected to ORACLE
    DECLARE
    ERROR at line 1:
    ORA-03113: end-of-file on communication channelAt the same time
    SQL> DECLARE
      2   C1 l_ref_cursor.rc;
      3   R_C1 DEPARTMENT%ROWTYPE;
      4  BEGIN
      5    P_RET_REF_CURSOR(7124284,C1);
      6    LOOP
      7     FETCH C1 INTO R_C1;
      8     EXIT WHEN C1%NOTFOUND;
      9     DBMS_OUTPUT.PUT_LINE(R_C1.ENAME);
    10    END LOOP;
    11  end;
    12  /
    SINGH
    PL/SQL procedure successfully completed.Rgds.

  • Dynamic REF Cursor with Dynamic Fetch - Urgent

    i have a pl/sql package with generates dynamic SQL statments. my problem is i want to open this SQL statment dynamically and fetch data in dynamic variable.
    declare
    type type_temp is REF CURSOR;
    cur_temp type_temp;
    mv_sql varchar2(4000);
    begin
    -- this will be dunamically generated and
    -- hence could have any no. of columns.
    mv_sql := select f1, f2, f3, f4 from table_temp;
    open cur_temp for mv_sql;
    fetch cur_temp into c1, c2, c3, c4;
    close cur_temp;
    end;
    problem is my sql statment will have N no. of columns how can i fetch this N no. of columns.

    Very hard problem, because ref cursors do not (directly) support description!
    Se mine (non-ideal) solution (it may be doable, but it isn't very practical
    or easily maintainable):
    1. "Generic" package
    CREATE OR REPLACE PACKAGE dyn_fetch IS
    TYPE ref_cur_t IS REF CURSOR;
    g_query VARCHAR2 (32000);
    g_count NUMBER;
    g_desc_tab DBMS_SQL.DESC_TAB;
    varchar2_type CONSTANT PLS_INTEGER := 1;
    number_type CONSTANT PLS_INTEGER := 2;
    date_type CONSTANT PLS_INTEGER := 12;
    rowid_type CONSTANT PLS_INTEGER := 11;
    char_type CONSTANT PLS_INTEGER := 96;
    long_type CONSTANT PLS_INTEGER := 8;
    raw_type CONSTANT PLS_INTEGER := 23;
    mlslabel_type CONSTANT PLS_INTEGER := 106;
    clob_type CONSTANT PLS_INTEGER := 112;
    blob_type CONSTANT PLS_INTEGER := 113;
    bfile_type CONSTANT PLS_INTEGER := 114;
    PROCEDURE describe_columns;
    FUNCTION record_def RETURN VARCHAR2;
    END;
    CREATE OR REPLACE PACKAGE BODY dyn_fetch IS
    PROCEDURE describe_columns IS
    l_cur INTEGER;
    BEGIN
    l_cur := DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE (l_cur, g_query, DBMS_SQL.NATIVE);
    DBMS_SQL.DESCRIBE_COLUMNS (l_cur, g_count, g_desc_tab);
    DBMS_SQL.CLOSE_CURSOR (l_cur);
    EXCEPTION
    WHEN OTHERS THEN
    IF DBMS_SQL.IS_OPEN (l_cur) THEN
    DBMS_SQL.CLOSE_CURSOR (l_cur);
    END IF;
    RAISE;
    END;
    FUNCTION record_def RETURN VARCHAR2 IS
    l_record_def VARCHAR2 (32000);
    l_type VARCHAR2 (100);
    l_col_type PLS_INTEGER;
    l_col_max_len PLS_INTEGER;
    l_col_precision PLS_INTEGER;
    l_col_scale PLS_INTEGER;
    BEGIN
    FOR i IN 1..g_count LOOP
    l_col_type := g_desc_tab(i).col_type;
    l_col_max_len := g_desc_tab(i).col_max_len;
    l_col_precision := g_desc_tab(i).col_precision;
    l_col_scale := g_desc_tab(i).col_scale;
    IF l_col_type = varchar2_type THEN
    l_type := 'VARCHAR2(' || l_col_max_len || ')';
    ELSIF l_col_type = number_type THEN
    l_type := 'NUMBER(' || l_col_precision || ',' || l_col_scale || ')';
    ELSIF l_col_type = date_type THEN
    l_type := 'DATE';
    ELSIF l_col_type = rowid_type THEN
    l_type := 'ROWID';
    ELSIF l_col_type = char_type THEN
    l_type := 'CHAR(' || l_col_max_len || ')';
    -- ELSIF l_col_type = ...
    -- long_type, raw_type ...
    END IF;
    l_record_def := l_record_def || ' col_' || i || ' ' || l_type || ',';
    END LOOP;
    l_record_def := RTRIM (l_record_def, ',');
    RETURN l_record_def;
    END;
    END;
    Note that procedure "record_def" creates columns names as col_1 (col_2 ...)
    because SELECT clause in your query can be without aliases, for example
    "SELECT deptno || dname FROM dept".
    2. Your package which returns query nad ref cursor
    CREATE OR REPLACE PACKAGE test IS
    PROCEDURE set_query (p_query VARCHAR2 := NULL);
    FUNCTION ref_cur RETURN dyn_fetch.ref_cur_t;
    END;
    CREATE OR REPLACE PACKAGE BODY test IS
    PROCEDURE set_query (p_query VARCHAR2 := NULL) IS
    l_query VARCHAR2 (32000) :=
    ' SELECT e.empno, e.ename,' ||
    ' e.deptno, d.dname' ||
    ' FROM emp e,' ||
    ' dept d' ||
    ' WHERE e.deptno = d.deptno';
    BEGIN
    IF p_query IS NULL THEN
    dyn_fetch.g_query := l_query;
    ELSE
    dyn_fetch.g_query := p_query;
    END IF;
    END;
    FUNCTION ref_cur RETURN dyn_fetch.ref_cur_t IS
    l_ref_cur dyn_fetch.ref_cur_t;
    BEGIN
    OPEN l_ref_cur FOR dyn_fetch.g_query;
    RETURN l_ref_cur;
    END;
    END;
    Why we need two separate procedures (functions) in your package ?
    a) Receiving program must use dynamic SQL, but in dynamic block we can access
    only PL/SQL code elements that have global scope (standalone functions and procedures,
    and elements defined in the specification of a package).
    Unfortunately, cursor variables cannot be defined in the specification of a package
    (cannot be global variables).
    b) Receiving program must get the column list before ref cursor.
    So, we have two options: call (in receiving program) the same function two times
    (once to get the column list and once to return a ref cursor)
    or use one procedure (or function) for returning query (to get the column list)
    and second function for returning a ref cursor.
    3. Your receiving program
    CREATE OR REPLACE PROCEDURE test_fetch_ref_cur (p_query VARCHAR2 := NULL) IS
    l_statement VARCHAR2 (32000);
    FUNCTION process_def RETURN VARCHAR2 IS
    l_process_def VARCHAR2 (32000);
    BEGIN
    l_process_def := 'DBMS_OUTPUT.PUT_LINE (';
    FOR i IN 1 .. dyn_fetch.g_count LOOP
    l_process_def := l_process_def || ' l_record.col_' || i || ' || ''>>'' || ';
    END LOOP;
    l_process_def := RTRIM (l_process_def, ' || ''>>'' || ') || ');';
    RETURN l_process_def;
    END;
    BEGIN
    test.set_query (p_query);
    dyn_fetch.describe_columns;
    l_statement :=
    ' DECLARE' ||
    ' TYPE record_t IS RECORD (' ||
    dyn_fetch.record_def || ');' ||
    ' l_record record_t;' ||
    ' l_ref_cur dyn_fetch.ref_cur_t;' ||
    ' BEGIN' ||
    ' l_ref_cur := test.ref_cur;' ||
    ' LOOP' ||
    ' FETCH l_ref_cur INTO l_record;' ||
    ' EXIT WHEN l_ref_cur%NOTFOUND;' ||
    process_def ||
    ' END LOOP;' ||
    ' CLOSE l_ref_cur;' ||
    ' END;';
    EXECUTE IMMEDIATE l_statement;
    END;
    You can test this with:
    SET SERVEROUTPUT ON;
    EXECUTE test_fetch_ref_cur;
    Note that we can try to use more generic solution:
    CREATE OR REPLACE PACKAGE dyn_fetch IS
    -- SAME AS BEFORE, PLUS:
    PROCEDURE fetch_ref_cur (
    p_function_ref_cur VARCHAR2,
    p_process_def VARCHAR2);
    END;
    CREATE OR REPLACE PACKAGE BODY dyn_fetch IS
    -- SAME AS BEFORE, PLUS:
    PROCEDURE fetch_ref_cur (
    p_function_ref_cur VARCHAR2,
    p_process_def VARCHAR2)
    IS
    l_statement VARCHAR2 (32000);
    BEGIN
    l_statement :=
    ' DECLARE' ||
    ' TYPE record_t IS RECORD (' ||
    record_def || ');' ||
    ' l_record record_t;' ||
    ' l_ref_cur dyn_fetch.ref_cur_t;' ||
    ' BEGIN' ||
    ' l_ref_cur := ' ||
    p_function_ref_cur || ';' ||
    ' LOOP' ||
    ' FETCH l_ref_cur INTO l_record;' ||
    ' EXIT WHEN l_ref_cur%NOTFOUND;' ||
    p_process_def ||
    ' END LOOP;' ||
    ' CLOSE l_ref_cur;' ||
    ' END;';
    EXECUTE IMMEDIATE l_statement;
    END;
    END;
    CREATE OR REPLACE PROCEDURE test_fetch_ref_cur (p_query VARCHAR2 := NULL) IS
    FUNCTION process_def RETURN VARCHAR2 IS
    -- SAME AS BEFORE
    END;
    BEGIN
    test.set_query (p_query);
    dyn_fetch.describe_columns;
    dyn_fetch.fetch_ref_cur (
    p_function_ref_cur => 'test.ref_cur',
    p_process_def => process_def);
    END;
    Regards,
    Zlatko Sirotic

  • Ref Cursor closed returning to Form

    Hi,
    I came across this old thread which seems to be an exact match for my problem.
    sys ref cursor is closed
    And whereas the solutions do work as stated there is an issue with it that i wonder if anyone here has since got around.
    Take those examples and make the sql dynamic. on return to the form the ref cursor is instantaneouly closed for you making the thing unusable.
    i.e.
    OPEN cur FOR SELECT 'x' from dual
    works just fine but
    OPEN cur FOR 'SELECT ''X'' from dual'
    resutls in an closed cursor the moment the ref cursor parameter returns to the form. I need the dynamic form because my cursor is truly built dynamically.
    Any ideas anyone?

    Hi,
    try this :
    1. declare in the package specification
    TYPE rec_view IS RECORD(
      COL1        VARCHAR2(250),
      COL2        VARCHAR2(250),
      COL3        VARCHAR2(250),
      COL4        VARCHAR2(250),
      COL5        VARCHAR2(250)
      TYPE t_ref_curs IS REF CURSOR RETURN rec_view;
      TYPE t_rec_c IS REF CURSOR;
    2. define the dynamic sql - procedure
    PROCEDURE   prc_getdata (p_refcur IN OUT t_ref_curs, p_result OUT VARCHAR2,
                             p_filter IN varchar2 DEFAULT NULL, p_orderby In VARCHAR2 DEFAULT NULL)  IS
      BEGIN
            -- dyn cursor ! --
            EXECUTE IMMEDIATE
                    'BEGIN
                          OPEN :a FOR ' ||
                              ' select empno, ename, job, mgr, hiredate, sal  from emp'||' '||
                                p_filter  ||' '||
                                p_orderby ||'; '||
                     'END;'
               USING p_refcur;
       END prc_getdata;
    3. define in the Form a PL/SQL based block on this procedure.
    Hope it helps.
    Best regards
    Friedhold

  • Performance problem with sproc and out parameter ref cursor

    Hi
    I have sproc with Ref Cursor as an OUT parameter.
    It is extremely slow looping over the ResultSet (does it record by record in the fetch).
    so I have added setPrefetchRowCount(100) and setPrefetchMemorySize(6000)
    pseudo code below:
    string sqlSmt = "BEGIN get_tick_data( :v1 , :v2); END;";
    Statement* s = connection->createStatement(sqlStmt);
    s->setString(1, i1);
    // cursor ( f1 , f2, f3 , f4 , i1 ) f for float type and i for interger value.
    // 5 columns as part of cursor with 4 columns are having float value and
    // 1 column is having int value assuming 40 bytes for one rec.
    s->setPrefetchRowCount (100);
    s->PrefetchMemorySize(6000);
    s->registerOutParam(2,OCCICURSOR);
    s->execute();
    ResultSet* rs = s->getCursor(2);
    while (rs->next()) {
    // do, and do v slowly!
    }

    Hi,
    I have the same problem. It seems, when retrieving cursor, that "setPrefetchRowCount" is not taking into account by OCCI. If you have a SQL statement like "SELECT STR1, STR2, STR3 FROM TABLE1" that works fine but if your SQL statement is a call to a stored procedure returning a cursor each row fetching need a roudtrip.
    To avoid this problem you need to use the method "setDataBuffer" from the object "ResultSet" for each column of your cursor. It's easy to use with INT type and STRING type, a lit bit more complex with DATE type. But until now, I'm not able to do the same thing with REF type.
    Below a sample with STRING TYPE (It's assuming that the cursor return only one column of STRING type):
    try
      l_Statement = m_Connection->createStatement("BEGIN :1 := PACKAGE1.GetCursor1(:2); END;");
      l_Statement->registerOutParam(1, oracle::occi::OCCINUMBER, sizeof(l_CodeErreur));
      l_Statement->registerOutParam(2, oracle::occi::OCCICURSOR);
      l_Statement->executeQuery();
      l_CodeErreur = l_Statement->getNumber(1);
      if ((int) l_CodeErreur     == 0)
        char                         l_ArrayName[5][256];
        ub2                          l_ArrayNameSize[5];
        l_ResultSet  = l_Statement->getCursor(2);
        l_ResultSet->setDataBuffer(1, l_ArrayName,   OCCI_SQLT_STR, sizeof(l_ArrayName[0]),   l_ArrayNameSize,   NULL, NULL);
        while (l_ResultSet->next(5))
          for (int i = 0; i < l_ResultSet->getNumArrayRows(); i++)
            l_Name = CString(l_ArrayName);
    l_Statement->closeResultSet(l_ResultSet);
    m_Connection->terminateStatement(l_Statement);
    catch (SQLException &p_SQLException)
    I hope that sample help you.
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem in opening a ref cursor.

    Hi,
    I'm getting the following error when i'm trying to open the ref cursor. PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    What i'm trying to do is I'm dumping the data into pl/sql table and i want retrieving the by using a ref cursor. Please see the code and help me out.
    CREATE OR REPLACE PACKAGE CPS_RECR.pg_pool_status AS
      TYPE pool_rec IS RECORD (
       status  varchar2(50)
      ,stsno number
      ,stscode varchar2(5)
      ,candidatename varchar2(200)
      ,monyear varchar2(10)
      ,yyyymm number
      ,stscnt number
      --type rec_sts_tab is table of number ;--index by pls_integer;
      type pool_tab IS table of pool_rec index by binary_integer;
      type pool_cv is REF CURSOR return pool_rec;
    FUNCTION pool_status_query(p_start_date in date,p_end_date in  date,p_invitedtopoolbit  in number,p_showedForPoolBit in  number)
       RETURN pool_tab;--pool_cv ;
      cursor cur_pool(p_start_date date,p_end_date date,p_invitedtopoolbit number,p_showedForPoolBit number)
      is
         SELECT   distinct to_char(date1,'yyyymm')yearmonth
                  FROM acs100data a,
                     acs100_candidate_verification b,                
                     acs100_candidate_pool d
                 WHERE UPPER (a.basic_email) = UPPER (b.email)
                 AND (b.candidate_status IN ('FORL', 'FWRT') or BITAND (b.candidate_status_bit, 4 ) > 0
                  or BITAND (b.candidate_status_bit, 2) > 0)                         
                 AND d.pool_id = b.pool_id
                 AND pool_date BETWEEN p_start_date AND p_end_date
                 AND is_tentative_date IS NULL  ;
      cursor cur_name(p_yyyymm varchar2,p_cond number,p_start_date date,p_end_date date)
      is
      select *
      from (select distinct (case
                                when p_cond = 0 and b.candidate_status = 'FORL'
                                   then (last_name || first_name)
                                when p_cond = 1 and b.candidate_status = 'FWRT'
                                   then (last_name || first_name)
                                when p_cond = 2
                                and bitand (b.candidate_status_bit, p_cond) > 0
                                   then (last_name || first_name)
                                when p_cond = 4
                                and bitand (b.candidate_status_bit, p_cond) > 0
                                   then (last_name || first_name)
                             end
                            ) candidatename
                       from acs100data a,
                            acs100_candidate_verification b,
                            acs100_candidate_pool d
                      where upper (a.basic_email) = upper (b.email)
                        and d.pool_id = b.pool_id
                        and pool_date between p_start_date and p_end_date
                        and to_char (date1, 'yyyymm') = p_yyyymm
                        and is_tentative_date is null)
    where candidatename is not null;  
    END pg_pool_status;
    CREATE OR REPLACE PACKAGE BODY CPS_RECR.pg_pool_status
    AS
       FUNCTION pool_status_query (
          p_start_date         IN   DATE,
          p_end_date           IN   DATE,
          p_invitedtopoolbit   IN   NUMBER,
          p_showedforpoolbit   IN   NUMBER
          RETURN pool_tab--pool_cv
       IS
          tab_pool    pool_tab;
          temp_rf    pool_cv;
          n_index     NUMBER         := 1;
          --rec_sts_data  rec_sts_tab;
          n_stscnt    NUMBER;
          vc_status   VARCHAR2 (100);
          vc_label  varchar2(1000);
          vc_name  varchar2(100);
       BEGIN
          tab_pool.DELETE;
          vc_label :='Opening Pool cursor';
          FOR rec_pool IN cur_pool (p_start_date,
                                    p_end_date,
                                    p_invitedtopoolbit,
                                    p_showedforpoolbit
          LOOP
              if cur_pool%notfound then
                exit;
              end if;
             vc_label :='Opening p_cond cursor';
             FOR p_cond IN 0 .. 3
             LOOP
                n_stscnt := 0;
                vc_status := NULL;
                begin
                    SELECT   SUM
                                (NVL
                                    (COUNT
                                        (CASE
                                            WHEN p_cond = 0
                                            AND b.candidate_status = 'FORL'
                                               THEN (last_name || first_name)
                                            WHEN p_cond = 1
                                            AND b.candidate_status = 'FWRT'
                                               THEN (last_name || first_name)
                                            WHEN p_cond = 2
                                            AND BITAND (b.candidate_status_bit,
                                                        p_cond) > 0
                                               THEN (last_name || first_name)
                                            WHEN p_cond = 4
                                            AND BITAND (b.candidate_status_bit,
                                                        p_cond) > 0
                                               THEN (last_name || first_name)
                                         END
                                     0
                                ) cnt,
                             DECODE (p_cond,
                                     0, 'FAILED WRITTEN TEST',
                                     1, 'FAILED **** TEST',
                                     2, 'Invited for Pool',
                                     4, 'Showed up for Pool'
                                    ) status
                        INTO n_stscnt,
                             vc_status
                        FROM acs100data a,
                             acs100_candidate_verification b,
                             acs100_candidate_pool d
                       WHERE UPPER (a.basic_email) = UPPER (b.email)
                         AND d.pool_id = b.pool_id
                         AND pool_date BETWEEN p_start_date AND p_end_date
                         AND TO_CHAR (date1, 'yyyymm') = rec_pool.yearmonth
                         AND is_tentative_date IS NULL
                    GROUP BY candidate_status,
                             b.candidate_status_bit,
                             DECODE (p_cond,
                                     0, 'FAILED WRITTEN TEST',
                                     1, 'FAILED **** TEST',
                                     2, 'Invited for Pool',
                                     4, 'Showed up for Pool'
                  exception
                     when no_data_found
                     then
                        n_stscnt :=0;
                        vc_status :=null;
                 end;
                vc_label :='Opening name cursor';         
                FOR rec_name IN cur_name (rec_pool.yearmonth,
                                          p_cond,
                                          p_start_date,
                                          p_end_date
                LOOP
                   if cur_name%notfound then
                   exit;
                   end if;
                   tab_pool (n_index).yyyymm := rec_pool.yearmonth;
                   tab_pool (n_index).stscnt := n_stscnt;
                   tab_pool (n_index).status := vc_status;
                   tab_pool (n_index).candidatename := rec_name.candidatename;
                   dbms_output.put_line('tab_pool(n_index).yyyymm  : '||tab_pool(n_index).yyyymm);
                   dbms_output.put_line('tab_pool(n_index).stscnt : '||tab_pool(n_index).stscnt);
                   dbms_output.put_line('tab_pool(n_index).status : '||tab_pool(n_index).status);
                   dbms_output.put_line('tab_pool(n_index).candidatename : '||tab_pool(n_index).candidatename);
                   vc_name :=rec_name.candidatename;
                END LOOP;
                n_index := n_index + 1;
             END LOOP;
          END LOOP;      
          RETURN tab_pool;
       exception
         when others
         then
             dbms_output.put_line('error :'||vc_label||'--'||  vc_name); 
       END;
    END pg_pool_status;
    ---run script
    DECLARE
      RetVal CPS_RECR.PG_POOL_STATUS.pool_tab;
      P_START_DATE DATE;
      P_END_DATE DATE;
      P_INVITEDTOPOOLBIT NUMBER;
      P_SHOWEDFORPOOLBIT NUMBER;
    temp_cv CPS_RECR.PG_POOL_STATUS.pool_cv;
    BEGIN
      P_START_DATE := to_date('09/01/2008','mm/dd/yyyy');
      P_END_DATE := to_date('09/30/2008','mm/dd/yyyy');
      P_INVITEDTOPOOLBIT := 2;
      P_SHOWEDFORPOOLBIT := 4;
      open temp_cv for select * from  table((CPS_RECR.PG_POOL_STATUS.POOL_STATUS_QUERY ( P_START_DATE, P_END_DATE, P_INVITEDTOPOOLBIT, P_SHOWEDFORPOOLBIT )) );
      end loop;
    exception
       when others
       then
          dbms_output.put_line(sqlerrm);
    END;

    Satyaki,
    It doesn't help me out. I'm worndering one of code sample is working fine. i didn't my current is giving the problem.
    FYI, please see the some code i followed.
    SQL> Create or replace PACKAGE cv IS
      2     type comp_rec is RECORD
      3               (deptno number,
      4                ename  varchar(10),
      5                compensation number);
      6     type comp_tbl IS table of comp_rec;
      7     function get_coll return comp_tbl pipelined;
      8     temp_tbl comp_tbl := comp_tbl();
      9     type comp_cv is REF CURSOR return comp_rec;
    10  end;
    11  /
    Package created.
    SQL> Create or replace PACKAGE body cv IS
      2     function get_coll return comp_tbl pipelined
      3     is
      4     begin
      5      for i in 1..temp_tbl.count loop
      6       pipe row(temp_tbl(i));
      7      end loop;
      8      return;
      9     end;
    10  end;
    11  /
    Package body created.
    SQL> declare
      2     temp_cv cv.comp_cv;
      3     rc cv.comp_rec;
      4  begin
      5           cv.temp_tbl.delete;
      6           cv.temp_tbl.extend;
      7    cv.temp_tbl(1).deptno:=10;
      8    cv.temp_tbl(1).ename:='1223';
      9    cv.temp_tbl(1).compensation:=10;
    10  
    11          -- erroring out
    12   open temp_cv for select * from  table(cv.get_coll);
    13          fetch temp_cv into rc;
    14          dbms_output.put_line('Deptno is ' || rc.deptno);
    15          dbms_output.put_line('ename is ' || rc.ename);
    16  end;
    17  /
    Deptno is 10
    ename is 1223
    PL/SQL procedure successfully completed.

  • Problem in passing ref cursor values as parameter in where clau.Most Urgent

    Problem:
    1) I have used normal cursor (C_hubmsgid_set) with some select statement such as grouping and all.
    After executing the query it will return some resultset to the specified cursor.
    2) I am trying to use another cursor which is ref cursor but the problem is
    I want to give all the resultset based on all the conditions to the ref cursor.
    But the cursor will get only the last record due to overwriting .how to get all
    the result set in a ref cursor like
    cursor c1 is select .....
    loop
    open refcursor for
    Select * from ....where condition
    end loop
    After this the refcursor( p_sysaudithistory_cur) which should have all the resultset matched by the where condition.
    3. It should be java compatible one.
    4. I am not able to match cursor row = IN Pameter value
    Below is the query:
    CREATE OR REPLACE PROCEDURE SP_TEST_audit_history2 (
    p_start IN date,
    p_end IN date,
    p_msgcode IN varchar2,
    p_partnername IN varchar2,
    p_status IN varchar2,
    p_locationname IN varchar2,
    p_custbusunit IN varchar2,
    p_sysaudithistory_cur OUT plutotypes.ref_cursor,
    p_status1 OUT NUMBER) AS
    l_status NUMBER := 0;
    CURSOR C_hubmsgid_set IS
    SELECT DISTINCT MAX(tfm.datetime) datetime, tfm.hubmsgid
    FROM tfm_status tfm, vw_msgcode_part_locn vw
    WHERE
    tfm.datetime >= NVL(p_start, TO_DATE('01/01/1981','DD/MM/YYYY')) AND
    tfm.datetime <= NVL(p_end, TO_DATE('31/12/9999','DD/MM/YYYY')) AND
    tfm.msgcode LIKE NVL(p_msgcode,'%') AND
    vw.msgcode = tfm.msgcode
    AND vw.partnername LIKE NVL(p_partnername,'%')
    AND tfm.status LIKE NVL(p_status,'%')
    AND vw.locationname LIKE NVL(p_locationname,'%')
    AND vw.custbusunit LIKE NVL(p_custbusunit,'%')
    AND rownum < 250
    GROUP BY tfm.hubmsgid
    ORDER BY datetime DESC;
    /* Loop through the Cursor */
    BEGIN
    BEGIN
    OPEN p_sysaudithistory_cur
    FOR
    SELECT
    tfm.hubmsgid ,
    tfm.status || '-'|| nvl2(tfm.exception_id,'FAILED','OK') ,
    tfm.datetime,
    tfm.exception_id
    FROM tfm_status tfm
    WHERE tfm.hubmsgid = c_hubmsgids.hubmsgid /* here only i am getting error*/
    AND tfm.datetime = c_hubmsgids.datetime
    AND tfm.status like NVL(p_status,'%')
    and rownum =1;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    l_status := 1;
    END;
    p_status1 := l_status;
    END;
    Thanks in advance
    prasanth a.s.

    Please don't post duplicate questions. All it does is clutter the forums and result in fragmented threads and duplicate responses. Please see my response in the original thread at the link below.
    Please solve this Refcursor issue PLEASE

  • Problem with accepting the Ref Cursor in c# program

    I am passing an argument as OUT Ref Cursor in a stored procedure. and calling the procedure from my c# program.
    I can connect the database successfully but am getting the error on calling the procedure.
    I am using the ODBC connection
    My procedure's signatures are like:
    CREATE OR REPLACE PACKAGE BODY packageName
    IS
    PROCEDURE GetOutput(returnCursor OUT Sys_RefCursor)
    AS
    BEGIN
    OPEN returnCursor FOR
    <<my select statement>>
    END GetOutput;
    END packageName;
    My function call is like:
    CString Extract::ExtractScript() const
         CString script;
         script.Format("{Call %s.%s()}", packageName,GetOutput);
         return script;
    I can compile the procedure successfully on Toad but while calling the procedure from the C# program it gives following error
    Connection Successful
    Problem executing SQL {Call packageName.GetOutput()}...
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GetOutput'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Message was edited by:
    user653288

    Hi Aga,
    Thanks for your response.
    I figured out the problem.
    I was using the ODBC connection which wasnt updated for Oracle 10g.
    I have updated that. Now its working fine.
    Thanks again
    Regards

  • Problem declaring and using a REF CURSOR

    I'm having a real problem using a REF CURSOR type
    Here's the DECLARE and the start of the BEGIN I've so far developed.
    DECLARE
    TYPE r1 IS RECORD (
    szvcapc_pidm szvcapc.szvcapc_pidm%TYPE,
    szvcapc_term_code szvcapc.szvcapc_term_code%TYPE,
    szvcapc_request_no szvcapc.szvcapc_request_no%TYPE);
    szvcapc_rec r1;
    TYPE cursor_1 IS REF CURSOR RETURN r1;
    szvcapc_cv cursor_1;
    TYPE r2 IS RECORD (
    stvests_code stvests.stvests_code%TYPE
    stvests_rec r2;
    TYPE cursor_2 IS REF CURSOR RETURN stvests_rec;
    stvests_cv cursor_2;
    BEGIN
    OPEN szvcapc_cv FOR
    SELECT szvcapc_pidm, szvcapc_term_code, szvcapc_request_no
    FROM szvcapc
    WHERE szvcapc_passed_ind = 'Y'
    AND szvcapc_award_credits = 'N';
    LOOP
    FETCH szvcapc_cv INTO szvcapc_rec;
    EXIT WHEN szvcapc_cv%NOTFOUND;
    END LOOP;
    OPEN stvests_cv FOR
    SELECT stvests_code
    FROM stvests
    WHERE stvests_eff_headcount = 'Y';
    LOOP
    FETCH stvests_cv INTO stvests_rec;
    EXIT WHEN stvests_cv%NOTFOUND;
    END LOOP;
    SELECT *
    FROM (
    <snip>
    INNER JOIN stvests_rec
    ON SFBETRM.SFBETRM_ESTS_CODE = stvests_rec.STVESTS_CODE
    <snip>
    I later try to use the stvests_rec and szvcapc_rec in the main SELECT statement it doesn't recognise stvests_rec and szvcapc_rec as a "Table or View".
    I have to use a REF CURSOR as this code is ultimately for use in Oracle Reports.
    What am I doing wrong?

    > The reason I'm trying to use a REF CURSOR is that I was told that you
    couldn't use CURSORs in Oracle Reports.
    That does not change anything ito what happens on the Oracle server side. A cursor is a cursor is a cursor.
    Every single SQL winds up as a cursor. Each cursor has a reference handle to access and use. HOW this handle is used in the language differs. But that is a language issue and not an Oracle RDBMS issue.
    For example. An EXECUTE IMMEDIATE in PL/SQL creates a cursor handle and destroys it after use - automatically. An implicit cursor works the same. An explicit cursor you have the handle fetch from it and close from it when done.
    A ref cursor is simply a handle that can be returned to an external client - allowing that application to use the handle to fetch the rows.
    Do not think that a ref cursor is any different from the RDBMS side than any other cursor. The RDBMS does not know the difference. Does not care and nor should it.
    > I'm trying to reduce the hits on the database from nested selects by
    removing the dataset from the main SELECT statement and performing it only
    once outside and then referencing this previously collected dataset inside the
    main SELECT statement.
    Good stuff that you are considering SQL performance. But you need to make sure that you
    a) identify the performance inhibitor issue correctly
    b) address this issue correctly
    And you need to do that within SQL. Not PL/SQL. PL/SQL will always be slower at crunching data than SQL. For example, wanting to cache the data somehow to reduce the read overhead - that is exactly what the DB buffer cache does. It caches data. That is also exactly what the CBO will attempt - reduce the amount of data that needs to be read and processed.
    Not saying that the RDBMS can do it all. It needs help from you - in the form of a SQL that instructs it to process only the minimum amount of data required to get the required results. In the form of a sound physical design that provides optimal usage of data storage and access (like indexing, partitioning, clustering, etc).
    Bottom line - you cannot use a REF CURSOR to make a SQL go faster. A REF CURSOR is simply a cursor in the SQL Engine. A cursor is nothing but the "compiled-and-executable" code of a SQL "source program".

  • Ref.Cursor Problem - URGENT

    Hi Friends,
    For my report ( calc.rdf ) ,
    I am passing two input parameters P_Client_ID, P_Plan_ID.
    In .rdf, I had a ref.cursor for selecting records based on
    two input parameters values.
    case1:
    P_client_ID = 'SRINI'
    P_Plan_ID = '3232'
    My report is generating the output for plan 3232.
    case2:
    P_client_ID = 'SRINI'
    P_Plan_ID = NULL
    My report is generating the output for all plans.
    case3:
    P_client_ID = 'SRINI'
    P_Plan_ID = '3232,3257,3259'
    My report is not generating any output here.
    Only blanck page i am getting.
    How can i pass multiple plans to ref.cursor at a time ?
    Note:
    I now, we cannot make Lexical references in a PL/SQL statement.
    Any other way to solve this problem ?
    Thanks for Help,
    srini

    I think that you work with 'static' ref cursor.
    From Oracle 8.1.5, we can use 'dynamic' ref cursors.
    With 'dynamic' ref cursor we can avoid the use of lexical parameters in Reports 3.0 / 6i.
    With 'static' ref cursor this is not possible in all cases.
    For example, if we need dynamic WHERE, we practically can't use 'static' ref cursor.
    Example for 'dynamic' ref cursor (dynamic WHERE)
    1. Stored package
    CREATE OR REPLACE PACKAGE report_dynamic IS
    TYPE type_ref_cur_sta IS REF CURSOR RETURN dept%ROWTYPE; -- for Report Layout only
    TYPE type_ref_cur_dyn IS REF CURSOR;
    FUNCTION func_dyn (p_where VARCHAR2) RETURN type_ref_cur_dyn;
    END;
    CREATE OR REPLACE PACKAGE BODY report_dynamic IS
    FUNCTION func_dyn (p_where VARCHAR2) RETURN type_ref_cur_dyn IS
    l_ref_cur_dyn type_ref_cur_dyn;
    BEGIN
    OPEN l_ref_cur_dyn FOR
    'SELECT * FROM dept WHERE ' || NVL (p_where, '1 = 1');
    RETURN l_ref_cur_dyn;
    END;
    END;
    2.2 Query PL/SQL in Reports
    function QR_1RefCurQuery return report_dynamic.type_ref_cur_sta is
    begin
    return report_dynamic.func_dyn (:p_where);
    end;
    Note that Oracle Reports 3.0 / 6i needs 'static' ref cursor type for building Report Layout.
    So, in package specification we must have both ref cursor types, static for Report Layout
    and dynamic for ref cursor query.
    Regards
    Zlatko Sirotic

  • Problem in using ref cursor

    I have a procedure which is using one ref cursor as OUT paramater. Now when I call this procedure, it gives me the following error:
    ORA-00932: inconsistent datatypes: expected CURSER got NUMBER
    ORA-06512: at "APPS.ORDER_RETURN1", line 8
    ORA-06512: at "APPS.ORDER_RETURN2", line 4
    ORA-06512: at line 1
    Below is my code
    PROCEDURE ORDER_RETURN1(p_order OUT sys_refcursor) IS
    TYPE OE_ORDER_rcur IS REF CURSOR;
    rcur OE_ORDER_rcur;
    BEGIN
    OPEN rcur FOR
    SELECT ORDER_NUMBER FROM OE_ORDER_HEADERS_ALL WHERE ROWNUM < 4;
    FETCH rcur INTO p_order;
    CLOSE rcur;
    END ORDER_RETURN1;
    PROCEDURE ORDER_RETURN2 IS
    OE_ORDER_rcur11 sys_refcursor;
    BEGIN
    ORDER_RETURN1(OE_ORDER_rcur11);
    end;
    I tried to call proc ORDER_RETURN1 with the help of proc ORDER_RETURN2, but no change, it gives me same error if i call the first proc ORDER_RETURN1 or i call ORDER_RETURN2.
    I am stuck with this problem, I had used ref cursor in procedure but not able to call the procedure which uses ref cursor as OUT parameter.
    Please help me to resolve this.
    Thanks
    Nidhi..

    Check out this
    SQL>VARIABLE X REFCURSOR
    SQL>CREATE OR REPLACE PROCEDURE ORDER_RETURN1(p_order OUT sys_refcursor) IS
      2  BEGIN
      3  OPEN p_order FOR
      4  SELECT OBJECT_ID FROM ALL_OBJECTS WHERE ROWNUM < 4;
      5  END ORDER_RETURN1;
      6  /
    Procedure created.
    SQL>EXEC ORDER_RETURN1(:X)
    PL/SQL procedure successfully completed.
    SQL>PRINT X
    OBJECT_ID
             4
            39
            30
    SQL>Regards
    Arun

  • Problem with XSU when trying to execute pl/sql package returning ref cursor

    Hi,
    I'm exploring xsu with 8i database.
    I tried running sample program which I took from oracle
    documentation. Here is the details of these.
    ------create package returning ref cursor---
    CREATE OR REPLACE package testRef is
         Type empRef IS REF CURSOR;
         function testRefCur return empRef;
    End;
    CREATE OR REPLACE package body testRef is
    function testRefCur RETURN empREF is
    a empREF;
    begin
    OPEN a FOR select * from emp;
    return a;
    end;
    end;
    ---------package successfully created-----
    Now I use java program to generate xml data from ref cursor
    ------------java program ----------
    import org.w3c.dom.*;
    import oracle.xml.parser.v2.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    import java.io.*;
    public class REFCURt
    public static void main(String[] argv)
    throws SQLException
    String str = null;
    Connection conn = getConnection("scott","tiger"); //
    create connection
    // Create a ResultSet object by calling the PL/SQL function
    CallableStatement stmt =
    conn.prepareCall("begin ? := testRef.testRefCur();
    end;");
    stmt.registerOutParameter(1,OracleTypes.CURSOR); // set
    the define type
    stmt.execute(); // Execute the statement.
    ResultSet rset = (ResultSet)stmt.getObject(1); // Get the
    ResultSet
    OracleXMLQuery qry = new OracleXMLQuery(conn,rset); //
    prepare Query class
         try
    qry.setRaiseNoRowsException(true);
    qry.setRaiseException(true);
    qry.keepCursorState(true); // set options (keep the
    cursor alive..
         System.out.println("..before printing...");
    while ((str = qry.getXMLString())!= null)
    System.out.println(str);
         catch(oracle.xml.sql.OracleXMLSQLNoRowsException ex)
    System.out.println(" END OF OUTPUT ");
    qry.close(); // close the query..!
    // qry.close(); // close the query..!
    // Note since we supplied the statement and resultset,
    closing the
    // OracleXMLquery instance will not close these. We would
    need to
    // explicitly close this ourselves..!
    stmt.close();
    conn.close();
    // Get the connection given the user name and password..!
    private static Connection getConnection(String user, String
    passwd)
    throws SQLException
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@xxxx:1521:yyyy",user,passwd);
    return conn;
    when I ran the program after successful compilation,I got the
    following error
    ==========
    Exception in thread "main" oracle.xml.sql.OracleXMLSQLException:
    1
    at oracle.xml.sql.core.OracleXMLConvert.getXML(Compiled
    Code)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLString
    (OracleXMLQuery.java:263)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLString
    (OracleXMLQuery.java:217)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLString
    (OracleXMLQuery.java:194)
    at REFCURt.main(Compiled Code)
    ============================
    Can anybody tell me why I'm getting this error.Am I missing any
    settings?
    thanks

    We are using 8.1.7 Oracle db with latest xdk loaded.
    am I missing any settings?

Maybe you are looking for

  • Deleting a STO PO

    Hi All, I am trying to delete the STO PO For which the Goods issue has been done and accounting Doc has been cleared. when we check the Document flow it is showing me as below. Purchase order  xxxxxxxxxx                             31.10.11 Replen.Cr

  • Without restart/reload - web.xmlupdate security constraints, is it possible

    Is there a way to make use of the 9ias/j2ee security framework, where add/modify security constrains; change roles and url-patterns etc, in web.xml without having to restart/reload the webapp. Doesn�t Restart/reload remove existing user sessions from

  • How do I change the desktop picture on *all* windows with Lion?

    I'm sure I'm just missing a simple setting, but ...  I changed the desktop background to something I found I thought I'd like, using right click/use as desktop background.  Didn't like it.  Went to System prefs to change it, and selected the Pond Ree

  • PAN No. Filed modifiable for specific users in J1ID -- Vend/Cust Exis Dt.

    Dear All, Please let me know can we restrict the users for changing the PAN in J1ID  Vendor / Customer Excise Details. As of now, the Users change Excise related data from J1ID but we want that only specific users to change the PAN data, all other u

  • Unable to create or update object after creating database

    I have installed Oracle 8.1.6 on a Solaris server (with documentation, cause I'm not expert of Unix). Next I have created a database and a user (with the doc too !!) I can make select on all the objects of this database (system tables for example). I