Re: Cursor

From: Joe <dev(at)freedomcircle(dot)net>
To: Xavier Bermeo <xbermeo(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Cursor
Date: 2008-08-16 18:54:07
Message-ID: 48A7224F.50604@freedomcircle.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Xavier Bermeo wrote:
> Hi, guys.......
>
> I have problems with cursosrs.
>
> Anyone have an example complete the how load and read each position
> of a cursor?
>
> I wait your answer........
>
> Thanks.......guys

Assuming you're using ECPG, there are a couple of examples in the
documentation, e.g.,

http://www.postgresql.org/docs/8.3/static/ecpg-commands.html
(see Select using cursors:

http://www.postgresql.org/docs/8.3/static/ecpg-variables.html#AEN33442

The essence is you DECLARE the cursor, OPEN it and then FETCH rows in
some kind of loop, and finish by CLOSE cursor. To exit the loop, you
can check sqlca.sqlcode for 100 (NOT FOUND) or a SQLSTATE of 02000.

Joe

In response to

  • Cursor at 2008-08-16 17:53:48 from Xavier Bermeo

Browse pgsql-sql by date

  From Date Subject
Next Message Xavier Bermeo 2008-08-16 19:35:55 Cursor
Previous Message Xavier Bermeo 2008-08-16 17:53:48 Cursor