Search Postgresql Archives

SQL sentence to insert where updated rows is zero...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys,

It's just to ask you if there is a single SQL sentence to INSERT
values in case of UPDATE WHERE returns 0 rows updated. I mean, If I
write something like,

# update my_table set column1='value' where column2='key_value';

And system replies me with one "UPDATE 0" because there is no row at
column2 with value 'key_value'... is it possible to say here: in this
case, create one new row with 'value' - 'key_value'...?  like

# insert into my_table (column1, column2) values ('value', 'key_value');

Glus


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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux