display cursor contents

Поиск
Список
Период
Сортировка
От Steve P Shiflett
Тема display cursor contents
Дата
Msg-id OFFC71BF69.0E1B5FD3-ON882572BC.0058456E-882572BC.0058F5C8@FDS.com
обсуждение исходный текст
Ответы Re: display cursor contents
Список pgsql-general
I wish to display the output 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=#




Steve Shiflett
Operations Engineer
macys.com
415.422.1416
Steve.P.Shiflett@macys.com
AIM/ICQ: spsshiflett


В списке pgsql-general по дате отправления:

Предыдущее
От: steve shiflett
Дата:
Сообщение: Display Cursor Content - Help!
Следующее
От: "richyen3@gmail.com"
Дата:
Сообщение: median query causes disk to fill up