Thread: INSERT or UPDATE
Hello I have an XML file, which i must import into the database. I transform this XML File with xslt to sql INSERTS. 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? Thanks Andreas
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