Monday, August 18, 2008

Re: [SQL] INSERT or UPDATE

am Mon, dem 18.08.2008, um 9:44:48 +0200 mailte Andreas Kraftl folgendes:
> But there is also the possibility, that one row is available. Means that
> i need an UPDATE instead of the INSERT.
>
> Is it in SQL possible to decide if there is an UPDATE or an INSERT or
> must i program something with PHP for example?

You can use a own function for this, see
http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
Example 38-1. Exceptions with UPDATE/INSERT


HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

No comments: