Re: Using Insert with case
От | David Johnston |
---|---|
Тема | Re: Using Insert with case |
Дата | |
Msg-id | 012901cd74ef$353b7ff0$9fb27fd0$@yahoo.com обсуждение исходный текст |
Ответ на | Using Insert with case ("Bob Pawley" <rjpawley@shaw.ca>) |
Список | pgsql-general |
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Bob Pawley Sent: Tuesday, August 07, 2012 6:26 PM To: Postgresql Subject: [GENERAL] Using Insert with case 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 ============================================================== Your statement is syntactically wrong. If you provide your version and a better idea of what you are trying to accomplish someone may be able to provide meaningful advice. You should also provide the entire query. I assume you are not due to the missing "END" after your CASE construct. There is also no location for "somevariable" to actual come from. As thought starters you can place the INSERT statement into a function OR you can try using WITH ( INSERT RETURNING ); which one if either is workable depends on more information than you have provided. You can also use plpgsql to encapsulate the procedural logic. You can either write a named function or you can use "DO". David J.
В списке pgsql-general по дате отправления: