
January 21st, 2004, 09:27 PM
|
 |
Psycho Canadian
|
|
Join Date: Jan 2001
Location: Canada
|
|
|
Searching within a CURSOR
First this is not within a function it's just a query. Now I've gotten CURSOR to work with the below query and it works great for something.
Code:
BEGIN WORK;
DECLARE tmp SCROLL CURSOR FOR SELECT id FROM mytable ORDER BY timestamp;
FETCH NEXT FROM tmp;
FETCH PRIOR FROM tmp;
CLOSE tmp;
COMMIT WORK;
but what I'm stuck on is searching within the cursor, a friend of mine said there should be a find command but he hasn't worked with Postgres's version of CURSOR but another one so I think he maybe wrong.
I can do
Code:
DECLARE tmp SCROLL CURSOR FOR SELECT id FROM mytable WHERE id = 35;
but then the next and previous are empty (I need it ordered by timestamp)
I do hope this is understood because I won't be able to answer anything (after tonight) till I get back on Sunday or Monday but feel free to leave an answer  thanks
|