Re: pl/pgsql switch - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: pl/pgsql switch
Date
Msg-id 20060124205138.GA91099@winnie.fuhr.org
Whole thread Raw
In response to pl/pgsql switch  ("Luis Silva" <lfs12@hotmail.com>)
List pgsql-novice
On Tue, Jan 24, 2006 at 05:51:37PM +0000, Luis Silva wrote:
> I there, do we have switch(){ case:} in pl/pgsql. Tks

See the PL/pgSQL documentation, in particular the "Control Structures"
section.  Here's the link for 8.1 (but use the documentation for
whatever version you're running):

http://www.postgresql.org/docs/8.1/interactive/plpgsql-control-structures.html

The documentation shows no switch/case structure but you should be
able to do the same thing with IF-THEN-ELSIF.  However, SQL does
have a CASE expression that you might be able to use:

http://www.postgresql.org/docs/8.1/interactive/functions-conditional.html

--
Michael Fuhr

pgsql-novice by date:

Previous
From: "Luis Silva"
Date:
Subject: pl/pgsql switch
Next
From: Michael Fuhr
Date:
Subject: Re: default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP