Skip site navigation (1) Skip section navigation (2)

Re: If Statement

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: If Statement
Date: 2007-02-04 18:25:28
Message-ID: 20070204182528.GA632@a-kretschmer.de (view raw or flat)
Thread:
Lists: pgsql-novice
am  Sun, dem 04.02.2007, um 20:15:33 +0200 mailte Greg Quinn folgendes:
> 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;

IF is only possible inside plpgsql¹, not in plain SQL. And, your check is
always true because 1 = 1 is always true.

¹ or an other language


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

In response to

Responses

pgsql-novice by date

Next:From: Greg QuinnDate: 2007-02-04 18:51:54
Subject: Re: SPAM-LOW: Re: If Statement
Previous:From: Greg QuinnDate: 2007-02-04 18:15:33
Subject: If Statement

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group