Re: embedded SQL cursos declare fails

From: "Thalis A(dot) Kalfigopoulos" <thalis(at)cs(dot)pitt(dot)edu>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: embedded SQL cursos declare fails
Date: 2001-06-19 16:09:05
Message-ID: Pine.LNX.4.21.0106191200140.24987-100000@aluminum.cs.pitt.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 19 Jun 2001, Michael Meskes wrote:

> On Mon, Jun 18, 2001 at 03:59:56PM -0400, Thalis A. Kalfigopoulos wrote:
> > EXEC SQL DECLARE my_cursor CURSOR FOR SELECT a,b FROM lala WHERE a= :i;
> > EXEC SQL FETCH FORWARD NEXT FROM my_cursor INTO :tmpa,:tmpb;
>
> Is there an EXEC SQL OPEN CURSOR my_cursor in between these lines?
>
> > I check the .c file generated by ecpg and the cursor declaration is commented out :-(
>
> That's correct. It's placed at the OPEN spot.

Correct, it works. But I was confused because the documentation (http://www.postgresql.org/idocs/index.php?ecpg-develop.html) mentions:

Open cursor statement
An open cursor statement looks like:
exec sql open cursor;
and is ignore and not copied from the output.

This gave me the impression that no explicit OPEN is necessary to operate on the cursor (normal Pg behavior). If not just my misunderstanding, someone rephrase thin in the docs.

cheers,
thalis

>
> Michael
> --
> Michael Meskes
> Michael(at)Fam-Meskes(dot)De
> Go SF 49ers! Go Rhein Fire!
> Use Debian GNU/Linux! Use PostgreSQL!
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thalis A. Kalfigopoulos 2001-06-19 16:57:00 Embedded sql PREPARE statement
Previous Message Vivek Khera 2001-06-19 15:53:57 Re: MySQL Question