Re: iterate over refcursor

Поиск
Список
Период
Сортировка
От Sim Zacks
Тема Re: iterate over refcursor
Дата
Msg-id d0k3qc$17tc$1@news.hub.org
обсуждение исходный текст
Ответ на iterate over refcursor  ("FERREIRA William (COFRAMI)" <william.ferreira@airbus.com>)
Список pgsql-general
try fetch as in:
 
fetch childcursor into variablelist;
while Found LOOP
    --Do stuff;
    --Do More Stuff;
    --Finish Doing Stuff;
    fetch childcursor into variablelist;
END LOOP;
 
found is set to false if there is nothing to fetch
 

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

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

Предыдущее
От: Hugo
Дата:
Сообщение: Re: Restoring db objects , help needed
Следующее
От: "Sim Zacks"
Дата:
Сообщение: Re: iterate over refcursor