Getting The Last Entry

From: Rodrigo Quezada <rotarantino(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Getting The Last Entry
Date: 2010-09-09 22:13:12
Message-ID: AANLkTimnpGpEFJzKWhijPTqUK=6T5UaxYs-KXDpRhcH4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello,

I need to get de last entry from a table. I try using:

DECLARE variable CURSOR FOR SELECT id FROM table;
FETCH LAST FROM variable;

And works fine, but when i try to use this code in a procedure, appears the
following message:

ERROR: syntax error at or near "FETCH"
LINE XX: FETCH LAST FROM raton;
^

********** Error **********

Is there another way to get that last ID?

----
Rodrigo

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bastiaan Olij 2010-09-09 22:15:24 Any known problems installing PG 8.4.4 on Win 2008 R2?
Previous Message Matthias Leopold 2010-09-09 20:54:29 Re: logging table changes