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

Home -> Community -> Usenet -> c.d.o.server -> Re: EXEC SQL FREE :the_cursor & PCC-S-02322

Re: EXEC SQL FREE :the_cursor & PCC-S-02322

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sun, 17 Oct 1999 13:16:14 GMT
Message-ID: <3809cbc5.29506233@news.demon.nl>


In PL/SQL and Pro*Pascal it's CLOSE <cursorname>. Most likely it is the same with Pro*C.

Hth,

Sybrand Bakker, Oracle DBA

On Sun, 17 Oct 1999 09:02:52 GMT, Alex Vinokur <alexander.vinokur_at_telrad.co.il> wrote:

>Thank you very much for your answers.
>However it does't work.
>I can't compile EXEC SQL FREE sss_cursor/:sss_cursor/:sss_cursor_name
>without error messages.
>
> Thanks,
> Alex
>
>
>In article <3806177A.2BB86789_at_bloomberg.net>,
> kagel_at_bloomberg.net wrote:
>[snip]
>> AHHH, I see the problem. In Informix ESQL/C the cursor, sss_cursor,
>is NOT a
>> host variable it is a hard coded cursor name, I'm sure that Oracle
>> Pro*C is the same. If the cursor is declared, as you did above, as:
>>
>> EXEC SQL DECLARE sss_cursor CURSOR FOR .....
>>
>> then the FREE statement is:
>>
>> EXEC SQL FREE sss_cursor;
>
>In this case I have got as following :
>===========================================
>
>Syntax error at line 18, column 16, file zzz.pc:
>Error at line 18, column 16 in file zzz.pc
> EXEC SQL FREE sss_cursor; // Line#18
>...............1
>PCC-S-02201, Encountered the symbol "sss_cursor" when expecting one of
>the follo
>wing:
>
> :
>The symbol ":" was substituted for "sss_cursor" to continue.
>
>Error at line 0, column 0 in file zzz.pc
>PCC-F-02102, Fatal error while doing C preprocessing
>
>===========================================
>
>>
>> However, at least in Informix ESQL/C and perhaps in Pro*C also, you
>MAY
>> declare a string type host variable and assign a cursor name to it and
>use
>> that in BOTH the DECLARE and FREE, thus:
>>
>> EXEC SQL BEGIN DECLARE SECTION;
>> char sss_curs_name[20];
>> EXEC SQL END DECLARE SECTION;
>>
>> strcpy( sss_curs_name, "sss_cursor" );
>> EXEC SQL DECLARE :sss_curs_name CURSOR FOR ....;
>> ::::::
>> EXEC SQL FREE :sss_curs_name;
>>
>
>In this case I have got the following error message :
>=================================================
>
>Syntax error at line 15, column 19, file zzz.pc:
>Error at line 15, column 19 in file zzz.pc
> EXEC SQL DECLARE :sss_curs_name CURSOR FOR sss_exec; // Line
>#15
>..................1
>PCC-S-02201, Encountered the symbol ":" when expecting one of the
>following:
>
> an identifier, a quoted string, count, avg, max, min, sum,
> stddev, variance,
>
>Syntax error at line 15, column 53, file zzz.pc:
>Error at line 15, column 53 in file zzz.pc
> EXEC SQL DECLARE :sss_curs_name CURSOR FOR sss_exec; // Line
>#15
>....................................................1
>PCC-S-02201, Encountered the symbol ";" when expecting one of the
>following:
>
> : ) [ ] / . an identifier, a numeric constant,
>
>Error at line 0, column 0 in file zzz.pc
>PCC-F-02102, Fatal error while doing C preprocessing
>===========================================================
>
>> Of course you CAN mix these two as the host variable sss_curs_name
>just
>> holds the actual cursor name you CAN use the actual cursor name OR the
>> hostname preceeded, as always, by a colon. So:
>>
>> EXEC SQL BEGIN DECLARE SECTION;
>> char sss_curs_name[20];
>> EXEC SQL END DECLARE SECTION;
>>
>> strcpy( sss_curs_name, "sss_cursor" );
>> EXEC SQL DECLARE :sss_curs_name CURSOR FOR ....;
>> ::::::
>> EXEC SQL FREE sss_cursor;
>
>Also error message :
>=============================================
>
>Syntax error at line 15, column 19, file zzz.pc:
>Error at line 15, column 19 in file zzz.pc
> EXEC SQL DECLARE :sss_curs_name CURSOR FOR sss_exec; // Line
>#15
>..................1
>PCC-S-02201, Encountered the symbol ":" when expecting one of the
>following:
>
> an identifier, a quoted string, count, avg, max, min, sum,
> stddev, variance,
>
>Syntax error at line 15, column 53, file zzz.pc:
>Error at line 15, column 53 in file zzz.pc
> EXEC SQL DECLARE :sss_curs_name CURSOR FOR sss_exec; // Line
>#15
>....................................................1
>PCC-S-02201, Encountered the symbol ";" when expecting one of the
>following:
>
> : ) [ ] / . an identifier, a numeric constant,
>
>Syntax error at line 0, column 0, file zzz.pc:
>Error at line 0, column 0 in file zzz.pc
>PCC-S-02201, Encountered the symbol "<eof>" when expecting one of the
>following:
>
> ; : an identifier, end-exec, random_terminal
>
>Error at line 0, column 0 in file zzz.pc
>PCC-F-02102, Fatal error while doing C preprocessing
>
>=============================================
>>
>> Should work as well.
>>
>> Art S. Kagel
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Sun Oct 17 1999 - 08:16:14 CDT

Original text of this message

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