Hi all!

How can I get oracle cursor from the out parameter of stored procedure?
For example, I have procedure declared by follow:

procedure  test1( i IN NUMBER,  i_out OUT CursorType );

And can't execute this procedure in C++ with SOCI lib.
Help me please.

I tryed following example:

===========
int main()
{
    session sql(oracle, "service=DEV1 user=vust password=vust");

    try {

        int i = 10;
        statement cursor( sql );

        statement st = ( sql.prepare << "begin test.test1( :i, :o_cursor );
end;",
                use( i, "i"),
                use( cursor, "o_cursor")
                );

        st.execute();    ///  <--- this line generate exception
        st.fetch();


        while (cursor.fetch()) {
            cout << "-----\n";
        }
    }
    catch (exception const &e) {
        cerr << "Some error: " << e.what() << endl;
    }
}

============
Result of execution of above example is:
"Some error: ORA-24333: zero iteration count"


PL/SQL code of test1() procedure:

<<<<<<<<<
create or replace package body test is

procedure test1(i in number, i_out out cursortype)
IS
BEGIN
  OPEN i_out FOR
    select * from LLO_BET_TYPE t
    where rownum <i;

END;

end test;
<<<<<<<<<<<

Thanks,
Victor

==
P.S.
The table LLO_BET_TYPE is contains a 20 records.
Procedure test1() is executed successfully from "Oracle SQL Developer", and
i can read data from cursor.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to