Re: [SQL] EXISTS

2008-10-11 Thread Leif B. Kristensen
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 ** > >ER

[SQL] EXISTS

2008-10-11 Thread Denis Woodbury
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

Re: [SQL] EXISTS

2008-10-11 Thread Tom Lane
Denis Woodbury <[EMAIL PROTECTED]> 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