Using Insert with case

From: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
To: "Postgresql" <pgsql-general(at)postgresql(dot)org>
Subject: Using Insert with case
Date: 2012-08-07 22:26:25
Message-ID: 5ACA3D3C33874B49A0D9A773C5488FF9@BobPC
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

select
case when somevariable = 2
then (insert into pipe (line)
select bob.edge_data.edge_id
from bob.edge_data, bob.node, pipe
where st_intersects(st_startpoint(bob.edge_data.geom), bob.node.geom)
and bob.node.node_id = 415
and pipe.id = 1)

I am attempting to use the above. However, with or without the enclosing brackets I get a syntax error on the word into.

Help will be appreciated.

Bob

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Angelico 2012-08-07 22:34:13 Re: Using Insert with case
Previous Message Robert Haas 2012-08-07 20:37:06 Re: Pg_ctl promote -- wait for slave to be promoted fully ?