Search Postgresql Archives

Re: Using Insert with case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 8, 2012 at 8:26 AM, Bob Pawley <rjpawley@xxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux