Re: Replace into... - Mailing list pgsql-novice

From Dani Oderbolz
Subject Re: Replace into...
Date
Msg-id 3F094F38.6060708@ecologic.de
Whole thread Raw
In response to Re: Replace into...  ("Boget, Chris" <chris@wild.net>)
List 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 by date:

Previous
From: wong siew hui
Date:
Subject: Problems with Installation of Perl-DBD-PG
Next
From: Michael Guerin
Date:
Subject: Multiple Resultsets