Re: cursors

From: Richard Huxton <dev(at)archonet(dot)com>
To: Hector Galicia <hgaliciac(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: cursors
Date: 2002-09-30 17:38:14
Message-ID: 200209301838.15142.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday 30 Sep 2002 5:24 pm, Hector Galicia wrote:
> Hi
> I'm new using postgressql, so my questions is about
> the use of cursors. I'm already know how to define,
> open and assign into a variable, but what I don't know
> is when the cursor is empty. Exist a function that
> tells me when the cursor is empty?

If you mean using cursors from plpgsql - check the FOUND variable. To quote
from section 23.7.3.1 of the manuals...

FETCH cursor INTO target;

FETCH retrieves the next row from the cursor into a target, which may be a
row variable, a record variable, or a comma-separated list of simple
variables, just as for SELECT INTO. As with SELECT INTO, the special variable
FOUND may be checked to see whether a row was obtained or not.

HTH, and check Roberto Mello's cookbook at techdocs.postgresql.org

- Richard Huxton

In response to

  • cursors at 2002-09-30 16:24:06 from Hector Galicia

Browse pgsql-general by date

  From Date Subject
Next Message Diogo Biazus 2002-09-30 17:41:16 Problem with corrupt index
Previous Message Josh Berkus 2002-09-30 17:29:34 Re: [GENERAL] arrays