plpgsql - fetching from returned cursors

From: "k|p" <m(dot)e(dot)meulemans(at)student(dot)utwente(dot)nl>
To: <pgsql-general(at)postgresql(dot)org>
Subject: plpgsql - fetching from returned cursors
Date: 2003-02-04 00:02:58
Message-ID: IFEALNEGLOIJHNCMHLILMEDHCBAA.m.e.meulemans@student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is something like this possible?
Because the way I wrote it now, nothing is FOUND from the FETCH and the loop is
exited.

CREATE OR REPLACE FUNCTION test(integer) RETURNS integer AS '
DECLARE
my_cursor refcursor;
my_row row;
BEGIN
my_cursor = get_refcursor($1);

LOOP
FETCH my_cursor INTO my_row;
EXIT WHEN NOT FOUND;
RAISE DEBUG ''id: %'', my_row.id;
END LOOP;
END;
' LANGUAGE 'plpgsql';

Thanks,
kip

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yolanda Valverde 2003-02-04 00:13:11 : How to create stored procedure in PostgreSQL?
Previous Message Robert Treat 2003-02-03 23:34:38 Re: Postgre vs SAP Db