I am a newbie in pl/pgsql, and I have no experience in Oracle's pl/sql either.
I am trying to create a function that can return the full result of a select
to an application connected via ODBC.
I have used the following code:
_________________________________
CREATE OR REPLACE FUNCTION test(VARCHAR) RETURNS refcursor AS '
DECLARE
cur refcursor;
BEGIN
cur := ''new_cursor'';
OPEN cur FOR EXECUTE ''SELECT * FROM test_table'';
RETURN cur;
END;
' LANGUAGE 'plpgsql';
________________________________
then I do in psql console:
BEGIN;
select test(1);
fetch ALL from new_cursor;
close new_cursor;
END;
in that way I get the result I want, the problem is that using an ODBC
connection I can't get a "begin - end" sequence so I can do a FETCH ALL in
the middle of it.
Is there any way to create a function that returns the complete list without
needing to create a "begin -end" sequence and then use a FETCH ALL??
thanx for yar help!