Re: EXISTS - Mailing list pgsql-sql

From Leif B. Kristensen
Subject Re: EXISTS
Date
Msg-id 200810111432.28239.leif@solumslekt.org
Whole thread Raw
In response to EXISTS  (Denis Woodbury <denis@woodmic.net>)
List pgsql-sql
On Saturday 11. October 2008, Denis Woodbury wrote:
>Hi,
>
>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
>
>If it can, any idea why I get this error.
>********** Error **********
>
>ERROR: syntax error at or near "IF"
>SQL state: 42601
>Character: 2

CASE IF NOT (SELECT 1 FROM Table WHERE col1 = 'mystring' )
THEN BEGIN
...
END
[ELSE BEGIN ... END];

-- 
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/


pgsql-sql by date:

Previous
From: Denis Woodbury
Date:
Subject: EXISTS
Next
From: Tom Lane
Date:
Subject: Re: EXISTS