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: Rab Boyce <Rab_at_MythSys.Demon.Co.Uk>
Date: Wed, 28 Apr 1999 17:15:30 +0100
Message-ID: <925316341.2938.0.nnrp-09.c2de90c2@news.demon.co.uk>


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.

Last- und Energiemanagement wrote in message <3726FE13.E232E81C_at_uumail.de>...
>It is possible to do this:
>
> EXEC SQL BEGIN DECLARE SECTION;
> int p1;
> sql_cursor s;
> EXEC SQL END DECLARE SECTION;
> EXEC SQL FETCH :s INTO :p;
>
>but it is not possible to do this:
>
> EXEC SQL BEGIN DECLARE SECTION;
> char szStatement[255];
> sql_cursor s;
> EXEC SQL END DECLARE SECTION;
> strcpy(szStatement, "SELECT * ....);
>
> EXEC SQL PREPARE SM FROM :szStatement;
>
> EXEC SQL DECLARE :s CURSOR for SM;
>
> EXEC SQL OPEN :s;
>
>In other words, I can fetch from a cursor that is a variable, but I can
>neither declare nor open it. The problem is, that I have to manage
>different cursors at the same time. Is there a way to do this?
>
>Thanks
>
>
>
Received on Wed Apr 28 1999 - 11:15:30 CDT

Original text of this message

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