From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: INSERT or UPDATE |
Date: | 2008-08-18 10:50:28 |
Message-ID: | 20080818105028.GA2567@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Nacef LABIDI | 2008-08-18 11:03:07 | Select function with set return type |
Previous Message | Andreas Kraftl | 2008-08-18 07:44:48 | INSERT or UPDATE |