Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: ProC/C++ question

Re: ProC/C++ question

From: Markus Pesti <markus.pesti_at_uumail.de>
Date: 28 Apr 1999 20:56:20 GMT
Message-ID: <372775EE.D9E1BDF7@uumail.de>


Rab Boyce wrote:

> You could DECLARE szStatement as a VARCHAR , then use
>
> strcpy((char *) szStatement.arr,"SELECT.... ");
> szStatement.len = (short) strlen((char *) szStatement.arr);
>
> to assign the statement to the Varchar.
>
> each time you want to remap the cursor you can simply repreprare and re open
> the cursor.
> You cannot do this to an open cursor however. (i.e you can only have one
> szStatement assigned to
> a cursor variable at any one time)
>
> This method will allow you to only declare one cursor and thus have less
> overhead.
>
>

I will have to explain my problem more detailed. I use this code in an own oracle class. The class contains a function:

    Open(const char* szStatement);
and a lot of functions:

    Fetch(param1, param2, ...);
It all works properly as long as I do not do this:

ORA ora1;
....
ora1.Open("SELECT * ....");
....
while(ora1.Fetch(p1, p2) != ORA_EOF)
{

    ...
    ORA ora2;
    ora2.Open("another SELECT ...."); // this SELECT statement depends on p1 and p2.

    ora2.Fetch(p3, p4);
    ...
    ora2.Close();
}
...
ora1.Close();

That does not work because both ORA objects use the same cursor. And for this reason I tried to have a member variable of type sql_cursor. Thus each instance of type ORA would have an own cursor, but unfortunately I did not succeed in doing:

    EXEC SQL DECLARE :s CURSOR for SM;

    EXEC SQL OPEN :s;

I hope you can help me now.

Thanks,
Markus Received on Wed Apr 28 1999 - 15:56:20 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US