Re: Using Insert with case

Поиск
Список
Период
Сортировка
От Bob Pawley
Тема Re: Using Insert with case
Дата
Msg-id 9FD642AD79934A00A9A7B596A2859FF9@BobPC
обсуждение исходный текст
Ответ на Re: Using Insert with case  (Alban Hertroys <haramrae@gmail.com>)
Список pgsql-general
Hi Alban

Probably no difference except I have four cases and I was trying, in an
attempt to save processing time, to compact commands a little.

Bob

-----Original Message-----
From: Alban Hertroys
Sent: Tuesday, August 07, 2012 3:40 PM
To: Bob Pawley
Cc: Postgresql
Subject: Re: [GENERAL] Using Insert with case

On 8 Aug 2012, at 24:26, Bob Pawley wrote:

> 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.

Is that somehow different from this?

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
and somevariable = 2


Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.


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

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