Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Scope of EXEC SQL DECLARE <cursor>
In article <7v431l$qnj$1_at_nnrp1.deja.com>,
Alex Vinokur <alexander.vinokur_at_telrad.co.il> wrote:
> 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.
Usage Notes
You must declare a cursor before referencing it in other embedded SQL statements. The scope of a cursor declaration is global within its precompilation unit and the name of each cursor must be unique in its scope. You cannot declare two cursors with the same name in a single precompilation unit.
</quote>
Now the matter is clear.
However, if we *cannot declare two cursors with the same name
in a single precompilation unit* why does the precompiler print warning message, but not error one?
[snip]
Alex
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Oct 26 1999 - 07:49:35 CDT