INSERT OR UPDATE WITHOUT SELECT

Поиск
Список
Период
Сортировка
Искать

INSERT OR UPDATE WITHOUT SELECT

От:
wmiro@ig.com.br <wmiro@ig.com.br>
Дата:
Hi, 

Is there a command to Insert a record If It does not exists and a update if 
It exists? 

I do not want to do a select before a insert or update. 

I mean the postgres should test if a record exist before insert and if It 
exist then the postgres must do an update instead an insert. 

Thanks, 

WMiro. 


Re: INSERT OR UPDATE WITHOUT SELECT

От:
"A. Kretschmer" <andreas.kretschmer@schollglas.com>
Дата:
am  30.05.2006, um 17:47:47 -0300 mailte wmiro@ig.com.br folgendes:
> Hi, 
> 
> Is there a command to Insert a record If It does not exists and a update if 
> It exists? 

Not a single command, but a solution:
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING


HTH, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 
FAQ