Skip site navigation (1) Skip section navigation (2)

Re: SQL( "if ...exists...),how to do it in the PostgreSQL?

From: Robert Forsman <thoth(at)purplefrog(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQL( "if ...exists...),how to do it in the PostgreSQL?
Date: 2001-06-06 22:32:37
Message-ID: 200106062232.SAA11021@nile.purplefrog.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Eric writes:

>    I can realize this function in the SYBase,but How can i do it in the PostgreSQL?
>
> /****SQL***/
> if not exists(select id from test) insert into test(id) values (280);
> /*********/

I don't know if this is SQL92, but 

insert into test(id) select 280 where not exists(select id from test);

pgsql-hackers by date

Next:From: Robert ForsmanDate: 2001-06-06 22:45:34
Subject: Re: Daily Digest V1 #1428
Previous:From: Alex PilosovDate: 2001-06-06 22:14:54
Subject: Re: [HACKERS] something smells bad

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group