Getting The Last Entry - Mailing list pgsql-novice

From Rodrigo Quezada
Subject Getting The Last Entry
Date
Msg-id AANLkTimnpGpEFJzKWhijPTqUK=6T5UaxYs-KXDpRhcH4@mail.gmail.com
Whole thread Raw
Responses Re: Getting The Last Entry
List 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

pgsql-novice by date:

Previous
From: Matthias Leopold
Date:
Subject: Re: logging table changes
Next
From: Bastiaan Olij
Date:
Subject: Any known problems installing PG 8.4.4 on Win 2008 R2?