Re: Pro*C - SQL_CURSOR variable/Dynamic SQL Method4 usage

From: Mike Krolewski <mkrolewski_at_rii.com>
Date: Thu, 04 Jan 2001 17:35:45 GMT
Message-ID: <932c9h$k8o$1_at_nnrp1.deja.com>


In article <93244j$c8c$1_at_nnrp1.deja.com>,   Mukund <mukundk_at_my-deja.com> wrote:
> I am trying to write a common Pro* C function that can open and setup
 a
> cursor given the cursor name and the select statement. I am thinking
 of
> passing the cursor name as a SQL_CURSOR variable and opening it inside
> the function. ORACLE documentation says that I cannot use EXEC SQL
 OPEN
> to open the cursor variable and has to be done inside a PL/SQL block
 or
> a stored procedure.
>
> Since I have the sql statement as a character string (passed into this
> function), I tried to use ANSI dynamic SQL method 4 to prepare and
> execute
> the statement. For opening the cursor I have two options: either EXEC
> SQL OPEN to open the cursor (where I cannot open the cursor variable)
> or I have to use the PL/SQL block (where I cannot use USING DESCRIPTOR
> for the input variables for the select statement). Is there any other
> way to do this with Pro* C or should I have to use OCI or can this be
> achieved by a combination of Pro *C, OCI and PL/SQL?
>
> Will really appreciate any help.
> Mukund
>
> Sent via Deja.com
> http://www.deja.com/
>

Yes you can do the former ie the EXEC SQL OPEN. You do not have to use the PL/SQL block. Although you can mix all three, it is far easier to stick to proC or OCI. IMHO proC is the better choice.

Follow the basic example in the manuals.

--
[Quoted] Michael Krolewski
Rosetta Inpharmatics
mkrolewski_at_rii.com
              Usual disclaimers


Sent via Deja.com
http://www.deja.com/
Received on Thu Jan 04 2001 - 18:35:45 CET

Original text of this message