Re: EXISTS

From: Denis Woodbury <denis(at)woodmic(dot)net>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: EXISTS
Date: 2008-10-14 14:03:56
Message-ID: BLU0-SMTP2556233E6F183278C27702CB310@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks to those who responded, I see PL/PgSQL is the way to go

Regards, denis woodbury

on 10/11/08 1:32 PM, [NAME] at [ADDRESS] wrote:

> 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

Browse pgsql-sql by date

  From Date Subject
Next Message Fernando Hevia 2008-10-14 15:27:01 Re: SELECT multiple MAX(id)s ?
Previous Message Craig Ringer 2008-10-14 07:48:33 Re: EXISTS