[GENERAL] Can a PL/PgSQL function return a cursor?

2001-01-13 Thread Jeff Duffy


 I have not had any luck getting a PL/PgSQL function that returns a 
cursor to compile. I've tried writing this in several forms, for 
instance;

CREATE FUNCTION getcursor() 
RETURNS cursor
AS
  'BEGIN
DECLARE testcursor CURSOR FOR
  SELECT * FROM test_table;
RETURN testcursor;
  END;'
LANGUAGE 'plpgsql';


but the parser always complains:

 ERROR:  parser: parse error at or near "cursor"

I assume this means that cursor is not a valid return type for PL/PgSQL 
functions? The point of this is to map queries that return large 
results sets to cursors for use in Java (through the ResultSet type).

 I'm using 7.0.3 on Red Hat 7.0.

Jeff



-- 
Errors have occurred.
We won't tell you where or why.
Lazy programmers.
-- Hacking haiku



[GENERAL] update field table.....

2001-01-13 Thread Muhammad Rusydi

Hi all,
i'm student from Indonesian :)
nice to meet the groupthis is my first email in this forumand i've a
lot of questions about Postgres
well, one of my problem now is:
i want to update some of my field on table...

sem   period

 3  2000/2001
 and i want it will be updated automatically to be.

sem   period

 4  2001/2002
if date on the system or server (Postgres) changed on if the month changed
from February to Marchand it'll also be update...

sem   period

 5  2002/2003
if the month change from Agustus to September
is it possible to do this with Postgres? If there's someone ever had
experienced like this, i will be grateful for your help.
thank's for the help...sorry...my english bad and i hope it'll
understandable :)
piece...
Rusydi