Re: passing cursors from one PL function to another

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: passing cursors from one PL function to another
Дата
Msg-id CAFj8pRA1jJjzm3btPAvMN=n4E6r59AkOGNuUfD_xCQ26U1fw4A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: passing cursors from one PL function to another  (Martín Marqués <martin.marques@gmail.com>)
Ответы Re: passing cursors from one PL function to another
Список pgsql-general
2011/8/29 Martín Marqués <martin.marques@gmail.com>:
> El día 29 de agosto de 2011 15:52, Pavel Stehule
> <pavel.stehule@gmail.com> escribió:
>> 2011/8/29 Martín Marqués <martin.marques@gmail.com>:
>>> El día 29 de agosto de 2011 15:28, Pavel Stehule
>>> <pavel.stehule@gmail.com> escribió:
>>>> 2011/8/29 Martín Marqués <martin.marques@gmail.com>:
>>>>> Actually, what we are trying to do is return 2 recordsets with the
>>>>> same function call (simulate SP from SQL Server returning 2
>>>>> recordsets).
>>>>>
>>>>> I found out that I had to do PERFORM * FROM construyecursordesdequery($1, query)
>>>>> which works now, but can't run 2 different queries on the same cursor.
>>>>>
>>>>
>>>> in your example you use a static cursor.
>>>
>>> As opposed to? I see no way to define a cursor not-static.
>>
>> refcursors can be dynamic defined
>
> OK, I'm totally lost. How do you define a dynamic cursor? Couldn't
> find anything in the manuals.
>

DECLARE
    curs1 refcursor;
BEGIN
 OPEN curs1 FOR EXECUTE 'SELECT ...';

>
> --
> Martín Marqués
> select 'martin.marques' || '@' || 'gmail.com'
> DBA, Programador, Administrador
>

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

Предыдущее
От: Martín Marqués
Дата:
Сообщение: Re: passing cursors from one PL function to another
Следующее
От: Martín Marqués
Дата:
Сообщение: Re: passing cursors from one PL function to another