Thank you Maciej, i found an error in my previous example.
It was the lost line  "st.exchange(...); " befor st.execute( true ).

In addition, i used st.execute() without parameter 'true'.
Exactly it generated exception "ORA-24333: zero iteration count" (!)
(By the way, in a test4  a function st.execute() is performed without
parameters).

So, if i use a std::string for exchange:

        std::string   st;
        statement cursor( sql );
        statement st = ( sql.prepare << "begin test.test1( 10, :o_cursor );
end;",
                use( cursor, "o_cursor" )
                );
        cursor.exchange( into(st) );
        st.execute( true );
        st.fetch();
        while (cursor.fetch()) {
          ...
        }

After execution,  I fetch only first column of cursor in 'st' variable.

Ok. But now i don't know how to fetch data  to row or rowset objects.

For example, if i use row object:

        row r;
        statement st = ( sql.prepare << "begin test.test1( 10, :o_cursor );
end;",
                use( cursor, "o_cursor" )
                );
        cursor.exchange( into(r) );
        st.execute( true );
        st.fetch();
        while (cursor.fetch()) {
          ...
        }

I get  "ORA-24374: define not done before fetch or execute and fetch"
after execution.


>The example in tests has the into() element, not use(). Did you try it?
I can't  try into() because, i need to bind a out parameter of stored
procedure (":o_cursor" in my example)
with statement cursor.

--
Victor



On Fri, Oct 9, 2009 at 4:20 PM, Maciej Sobczak <[email protected]> wrote:

> Hello,
>
> Viktor Ustynov wrote:
>
> > How can I get oracle cursor from the out parameter of stored procedure?
>
> The test suite for Oracle (src/backeds/oracle/test-oracle.cpp) contains
> an example with cursor (test4), which could (?) work with our parameter
> of a stored procedure.
>
> > 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")
> >                 );
>
> The example in tests has the into() element, not use(). Did you try it?
>
> In addition, the cursors will need to declare its own data bindings
> (presumably into(), as shown in the test suite).
>
> The example code from the test suite is:
>
>     statement stInner(sql);
>     statement stOuter = (sql.prepare <<
>         "select cursor(select name from soci_test order by id)"
>         " from soci_test where id = 1",
>         into(stInner));
>     stInner.exchange(into(name));
>     stOuter.execute();
>     stOuter.fetch();
>
>     std::vector<std::string> names;
>     while (stInner.fetch())    { names.push_back(name); }
>
> Regards,
>
> --
> Maciej Sobczak * www.msobczak.com * www.inspirel.com
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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