iterate over refcursor

From: "FERREIRA William (COFRAMI)" <william(dot)ferreira(at)airbus(dot)com>
To: "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: iterate over refcursor
Date: 2005-03-08 09:43:54
Message-ID: 1904E3EB39448246A7ECB76DF34A70B00143B46A@TOCOMEXC03
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi

I got 2 functions write in pl/pgsql.
In the first function, i create a cursor and i need to use it into an other
function
so the parameter is a refcursor.

the code :
1st function :
DECLARE
childCursor CURSOR FOR select * from ...
BEGIN
SORT_CHILDREN(childCursor);
END;

2nd function :
CREATE OR REPLACE FUNCTION SORT_CHILDREN(refCursor) RETURNS int4[] AS
$$
DECLARE
childCursor ALIAS FOR $1;
childRecord adoc.xdb_child%ROWTYPE;
BEGIN
FOR childRecord IN childCursor LOOP
...
END LOOP;
RETURN ...;
END;
$$ LANGUAGE plpgsql;

But it doesn't work.....

My problem is : how to iterate over a refcursor in a function ?

thanks in advance

Will

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Sidney-Woollett 2005-03-08 10:00:22 Re: problem with distinct rows
Previous Message Sanjay Arora 2005-03-08 09:32:04 RPM for whitebox linux - RH ES3 Clone