Re: If Statement - Mailing list pgsql-novice

From Phillip Smith
Subject Re: If Statement
Date
Msg-id 00f701c748a6$3fdc4640$9b0014ac@wbaus090
Whole thread Raw
In response to If Statement  ("Greg Quinn" <greg@officium.co.za>)
List 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@postgresql.org
[mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Greg Quinn
Sent: Monday, 5 February 2007 05:16
To: pgsql-novice@postgresql.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

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: SPAM-LOW: Re: If Statement
Next
From: "Peter Dawn"
Date:
Subject: Fill multiple fields through one INNER JOIN