Re: What about SELECT INTO in EXECUTE

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: What about SELECT INTO in EXECUTE
Дата
Msg-id 200303051843.22139.dev@archonet.com
обсуждение исходный текст
Ответ на Re: What about SELECT INTO in EXECUTE  (Ivan <iv@psycho.pl>)
Список pgsql-general
On Wednesday 05 Mar 2003 5:10 pm, Ivan wrote:
> but its not SQL error but just in plpgsql ,
> SELECT INTO same_var sth from table;
> I can not write EXECUTE ''SELECT INTO same_var sth from table;'';
> because SELECT INTO not work with EXECUTE , so what can i do else ?

Ah, sorry, I see what you're trying to do now.

You're quite right, the SELECT INTO <plpgsql-variable> construct only works
within plpgsql, whereas EXECUTE runs standard SQL.

The solution is to use the FOR ... IN ... EXECUTE loop structure (even if you
only want one row) - see the manual section on plpgsql control structures
(programmers guide) for details. This is a known limitation of the EXECUTE
command and is mentioned in the relevant section, but perhaps not clearly
enough.

HTH

--
  Richard Huxton

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

Предыдущее
От: Medi Montaseri
Дата:
Сообщение: Re: Why PostgreSQL?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: a date_part question