Re: Performing FETCH ALL from a SCROLL CURSOR failing to return results

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Performing FETCH ALL from a SCROLL CURSOR failing to return results
Дата
Msg-id 24903.1269553430@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Performing FETCH ALL from a SCROLL CURSOR failing to return results  (Eliot Gable <egable+pgsql-general@gmail.com>)
Список pgsql-general
Eliot Gable <egable+pgsql-general@gmail.com> writes:
> Inside my PL/PGSQL stored procedure, I am opening the cursor like so:

> OPEN source_host;
> FETCH source_host INTO src_host;

So you already fetched the one row in the cursor.  FETCH ALL really
means "fetch all the rest of the rows", which is why it returns nothing.
The other variants you mention will reposition the cursor so they can
re-read the row.

> I absolutely need to have FETCH ALL working.

It is working.  What you're not doing correctly is repositioning the
cursor to before the first row.  Try MOVE BACKWARDS ALL.

            regards, tom lane

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

Предыдущее
От: Eliot Gable
Дата:
Сообщение: Performing FETCH ALL from a SCROLL CURSOR failing to return results
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Get the list of permissions/privileges on schema