Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Scope of EXEC SQL DECLARE <cursor>
Hi,
Here is a program containing the same line
EXEC SQL DECLARE the_cursor CURSOR FOR the_exec; in two different functions (foo1 and foo2). I have got warning message (see below).
Does it mean that EXEC SQL DECLARE <cursor>
always has global scope?
If it is right, what is a reason for that?
(Does it depend on SQL scope?)
Ordinary internal variables have a local scope.
Do we have to use different names in
EXEC SQL DECLARE <cursor> even if these declarations are in different functions? If EXEC SQL DECLARE <cursor> has a global scope, why is the message warning one, but not error one? Thanks, Alex //######################################################### //------------------- Pro*C++ code : BEGIN ---------------- //==========================
#include <sqlca.h>
#include <sqlda.h>
#include <sqlcpr.h>
#include <oraca.h>
//========================== //############################### //###############################
private : public : void foo1 (); void foo2 ();
//############################### //===============================
EXEC SQL PREPARE the_exec FROM :host_command_line; EXEC SQL DECLARE the_cursor CURSOR FOR the_exec;
} // void FOO::foo1()
//===============================
EXEC SQL PREPARE the_exec FROM :host_command_line; EXEC SQL DECLARE the_cursor CURSOR FOR the_exec; // Line#43
} // void FOO::foo2()
//############################### //===============================
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=cppsys_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=ntt MODE=ORACLE LINES=YES CPP_SUFFIX=cpp CHAR_MAP=STRING
Pro*C/C++: Release 8.0.5.0.0 - Production on Tue Oct 26 12:48:2 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
Warning at line 43, column 19, file ntt.pc:
EXEC SQL DECLARE the_cursor CURSOR FOR the_exec;
..................1
[snip]
//------------------- Compilation Results : END ----------- //######################################################### //------------------- Environment ------------------------- === Oracle 8.0.5 === Pro*C/C++ : Release 8.0.5.0.0
//--------------------------------------------------------- //#########################################################
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Oct 26 1999 - 06:24:38 CDT