Re: Using Insert with case

Поиск
Список
Период
Сортировка
От Chris Angelico
Тема Re: Using Insert with case
Дата
Msg-id CAPTjJmq7n2H-=S1hDbnzLVFKeWn2LRfSam4ORnM4BvqZtNZSaw@mail.gmail.com
обсуждение исходный текст
Ответ на Using Insert with case  ("Bob Pawley" <rjpawley@shaw.ca>)
Список pgsql-general
On Wed, Aug 8, 2012 at 8:26 AM, Bob Pawley <rjpawley@shaw.ca> wrote:
> Hi
>
> select
> case when somevariable = 2
>     then (insert into pipe (line) ...
>
> I am attempting to use the above. However, with or without the enclosing
> brackets I get a syntax error on the word into.

Utterly untested, but does it work if you put a RETURNING clause onto
the INSERT? That would make it functionally similar to a SELECT, a
technique that works for me in other situations.

ChrisA

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

Предыдущее
От: "Bob Pawley"
Дата:
Сообщение: Using Insert with case
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Using Insert with case