From: | Jorge Sarmiento <jsarmiento(at)ccom(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | pl/pgsql question |
Date: | 2002-06-18 21:50:20 |
Message-ID: | 200206181750.20551.jsarmiento@ccom.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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!
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Atkins | 2002-06-18 21:57:12 | Web application frameworks supporting PostgreSQL |
Previous Message | Stephan Szabo | 2002-06-18 21:25:45 | Re: point-in-polygon error |