Re: Replace into...

Поиск
Список
Период
Сортировка
От Dani Oderbolz
Тема Re: Replace into...
Дата
Msg-id 3F094F38.6060708@ecologic.de
обсуждение исходный текст
Ответ на Re: Replace into...  ("Boget, Chris" <chris@wild.net>)
Список pgsql-novice
Boget, Chris wrote:

> >> Somebody else probably has a more clever way to do it though......
> >I would do this unconditionally.
> >UPDATE ... FROM ... WHERE EXISTS (SELECT ...)
> >INSERT INTO ... WHERE NOT EXISTS (SELECT ...)
> >That are still 2 queries, but better than playing around with triggers.
>
Hmm, in Oracle, before we had MERGE INTO
we did it in the Procedureal language:
- You try to update
- if it doesnt work, insert.

this would lead to such a structure:

update;
if not found then
    insert;
end if;

I hope this gives you a hint.
Cheers, Dani



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

Предыдущее
От: wong siew hui
Дата:
Сообщение: Problems with Installation of Perl-DBD-PG
Следующее
От: Michael Guerin
Дата:
Сообщение: Multiple Resultsets