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

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 14 Oct 1999 15:12:04 -0400
Message-ID: <CiUGOP3KW=54crXV1dFCDY5vTThR_at_4ax.com>


A copy of this was sent to Alex Vinokur <alexander.vinokur_at_telrad.co.il> [Quoted] [Quoted] (if that email address didn't require changing) On Thu, 14 Oct 1999 14:40:18 GMT, you wrote:

>Hi,
>
>Using the following command line (in Pro*C++ code)
> EXEC SQL FREE :sss_cursor;
> I have got an error message
> PCC-S-02322, found undefined identifier.
>
> 1. What is missing (or wrong) in this code
> (regarding compilation problems)?

sss_cursor is not a host variable -- only host variables are prefixed with :'s

since you have no host variables called sss_cursor, it gives you this error.

> 2. Do we have to use EXEC SQL FREE :sss_cursor;
> if we don't use EXEC SQL ALLOCATE :sss_cursor?
>

No, you only use free when you allocated a cursor.

> Thanks,
> Alex
>
>//#########################################################
>//------------------- Pro*C++ code : BEGIN ----------------
>
>//------------
>// File zzz.pc
>//------------
>#include <sqlca.h>
>#include <oraca.h>
>void foo()
>{
>EXEC SQL BEGIN DECLARE SECTION;
>char *select_sss="SELECT * FROM FFF";
>EXEC SQL END DECLARE SECTION;
>
> EXEC SQL PREPARE sss_exec FROM :select_sss;
> EXEC SQL DECLARE sss_cursor CURSOR FOR sss_exec;
> EXEC SQL OPEN sss_cursor;
>
> EXEC SQL CLOSE sss_cursor;
> EXEC SQL FREE :sss_cursor; // Line#16
>
>}
>
>//==================================
>int main ()
>{
> return 0;
>}
>
>
>//------------------- Pro*C++ code : END ------------------
>
>
>
>
>//#########################################################
>//------------------- Compilation Results : BEGIN ---------
>
>code=cpp
>sys_include=(/opt/SUNWspro/SC4.2/include,/opt/SUNWspro/SC4.2/include/CC,/usr/
>include,/opt/SUNWspro/RW/workspaces/SOLARIS26/SUNPRO42/7s) code=cpp
>sys_include=(/opt/SUNWspro/SC4.2/include,/opt/SUNWspro/SC4.2/include/CC,/usr/
>include,/opt/SUNWspro/RW/workspaces/SOLARIS26/SUNPRO42/7s) proc code=cpp
>sys_include='(/opt/SUNWspro/SC4.2/include,/opt/SUNWspro/SC4.2/include/CC,/usr
>/include,/opt/SUNWspro/RW/workspaces/SOLARIS26/SUNPRO42/7s)' iname=zzz
>LINES=YES CPP_SUFFIX=cpp
>
>Pro*C/C++: Release 8.0.5.0.0 - Production on Thu Oct 14 16:27:48 1999
>
>(c) Copyright 1998 Oracle Corporation. All rights reserved.
>
>System default option values taken from:
>/home/u01/app/oracle/product/8.0.5/precomp/admin/pcscfg.cfg
>
>Semantic error at line 16, column 17, file zzz.pc:
> EXEC SQL FREE :sss_cursor; // Line#16
>................1
>PCC-S-02322, found undefined identifier
>Semantic error at line 16, column 11, file zzz.pc:
> EXEC SQL FREE :sss_cursor; // Line#16
>..........1
>PCC-S-02319, expression type does not match usage
>Semantic error at line 16, column 11, file zzz.pc:
> EXEC SQL FREE :sss_cursor; // Line#16
>..........1
>PCC-S-02336, host variable expression has invalid type
>make: *** [doit] Error 1
>
>
>//------------------- Compilation Results : END -----------
>
>
>//#########################################################
>//------------------- System ------------------------------
>
>=== Oracle 8.0.5
>=== Pro*C/C++ : Release 8.0.5.0.0
>=== SunOS 5.6
>
>//---------------------------------------------------------
>
>//#########################################################
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

-- 
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
[Quoted] Current article is "Part I of V, Autonomous Transactions" updated June 21'st
 
[Quoted] Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation
Received on Thu Oct 14 1999 - 21:12:04 CEST

Original text of this message