PRO*C and scope of Cursors
From: David Barnes <dvb_at_dial.pipex.com>
Date: Thu, 06 Aug 1998 11:20:50 +0100
Message-ID: <35C98382.6008_at_dial.pipex.com>
[Quoted] Given the following structure:
Date: Thu, 06 Aug 1998 11:20:50 +0100
Message-ID: <35C98382.6008_at_dial.pipex.com>
[Quoted] Given the following structure:
function a()
{
stuff = b( foo );
}
[Pro*c]
function b( args )
{
EXEC SQL DECLARE
...
EXEC SQL ...
b0 = args;
etc ...
If ( first time )
EXEC SQL PREPARE xxx from "Select 'x' from dual WHERE DUMMY =
:b0";
EXEC SQL DECLARE C CURSOR FOR xxx;
END IF;
EXEC SQL OPEN C
EXEC SQL FETCH FROM C
etc..
}
I want to repeatedly call b() from a() but passing in different values
which are
stuffed into bind variables referenced in the CURSOR. So to avoid
re-parsing I want to re-OPEN C with the different values. BUT.... when
I re-call b() then the re-OPEN of the CURSOR fails unless I do another
PREPARE. I.e. can I have a static/persistent cursor that can be called
from outside and *NOT* be re-parsed. ??? This all works fine if it's
done within scope i.e. all inside the same 'C/PC' file but doing
everything in one file is not viable for any large application.
TIA,
David Barnes.
Received on Thu Aug 06 1998 - 12:20:50 CEST
