Re: ERROR: query has no destination for result data

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: ERROR: query has no destination for result data
Дата
Msg-id 50AF5BB3.6000503@hogranch.com
обсуждение исходный текст
Ответ на Re: ERROR: query has no destination for result data  (Peter Kroon <plakroon@gmail.com>)
Ответы Re: ERROR: query has no destination for result data  (Peter Kroon <plakroon@gmail.com>)
Список pgsql-general
On 11/23/12 2:53 AM, Peter Kroon wrote:
> I get another error:
> ERROR:  cannot use RETURN QUERY in a non-SETOF function
>

what is your function deined to return?

a query returns a set of records, even if that set is 1 record of 1
field (like, select 'some text';)

you could declare a record variable, and use SELECT ... INTO myrecordvar
[FROM ...];
http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW
then return a field of that record variable.

see this example...
http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING
... for how you would loop through query results


--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast



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

Предыдущее
От: Peter Kroon
Дата:
Сообщение: Prevent x005F from xml
Следующее
От: Peter Kroon
Дата:
Сообщение: Re: ERROR: query has no destination for result data