Re: If Statement

From: "Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
To: "'Greg Quinn'" <greg(at)officium(dot)co(dot)za>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: If Statement
Date: 2007-02-04 21:48:47
Message-ID: 00f701c748a6$3fdc4640$9b0014ac@wbaus090
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Perhaps what you actually want is the CASE function - it performs what most
people with previous programming experience would expect from IF

Cheers,
-p

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of Greg Quinn
Sent: Monday, 5 February 2007 05:16
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] If Statement

For some reason I cannot get an IF statement to work in PostGreSQL, even
though I am doing it in the format the manual tells me to...
Here is my query...

IF 1 = 1 THEN
update contacts set deleted = TRUE
END IF;

I get the error ERROR: syntax error at or near "IF" at character 1

I am using EMS's PostGreSQL Manager for windows.

Thanks

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee. If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message fbn 2007-02-05 16:55:30 Composed Key and autoincrement
Previous Message Tom Lane 2007-02-04 19:06:19 Re: SPAM-LOW: Re: If Statement