Search Postgresql Archives

Cursor Contents display in pgAdmin - Help.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)

COMMIT
xxx z=#
------------------------------------------------------------------------
(I am expecting the rows in the tmp.sps_measurement table.)  Can anyone help me out with this?

Steve





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux