From: | steve shiflett <steve(dot)postgres(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Display Cursor Content - Help! |
Date: | 2007-04-13 16:42:35 |
Message-ID: | 461FB2FB.6070608@shiflett.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I wish to display the content of a cursor but haven't discovered the
trick. Here's what I'm doing:
--------------------------------------------------------- The function
CREATE OR REPLACE FUNCTION tmp.sps(character varying, date)
RETURNS refcursor AS
$BODY$
DECLARE
ref refcursor;
BEGIN
OPEN ref FOR select * from tmp.sps_measurement where logdate < $2;
RETURN ref;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
----------------------------------------------------------- psql
script expected to display the contents of the cursor
BEGIN;
declare
ref cursor for select tmp.sps('=','2006-06-12') ;
FETCH all IN ref;
commit;
----------------------------------------------------------- Output:
xxx z=# \i sps_test.sql
BEGIN
DECLARE CURSOR
sps
--------------------
<unnamed portal 9>
(1 row)
(I am expecting the rows in the tmp.sps_measurement table.) Can anyone
help me out with this?
STEve
COMMIT
mdc_oz=#
From | Date | Subject | |
---|---|---|---|
Next Message | steve shiflett | 2007-04-13 17:46:53 | Cursor Contents display in pgAdmin - Help. |
Previous Message | Mason Hale | 2007-04-13 16:39:00 | error creating/setting sequence, pg_dump / pg_restore 8.1.5 |