Re: EXISTS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Denis Woodbury <denis(at)woodmic(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: EXISTS
Date: 2008-10-11 17:32:01
Message-ID: 23925.1223746321@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Denis Woodbury <denis(at)woodmic(dot)net> writes:
> I would like to know if this this type of statement can be used in
> Postgresql

> IF NOT EXISTS (SELECT 1 FROM Table WHERE col1 = 'mystring' )
> BEGIN
> ...
> END

I suspect you are trying to type that directly into SQL.
You need to be using plpgsql in order to use procedural
logic (ie, if/then).

regards, tom lane

In response to

  • EXISTS at 2008-10-11 11:22:09 from Denis Woodbury

Responses

  • Re: EXISTS at 2008-10-14 14:03:56 from Denis Woodbury

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Maier 2008-10-13 18:15:49 Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly
Previous Message Leif B. Kristensen 2008-10-11 12:32:28 Re: EXISTS