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