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

Re: pl/pgsql switch

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Luis Silva <lfs12(at)hotmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: pl/pgsql switch
Date: 2006-01-24 20:51:38
Message-ID: 20060124205138.GA91099@winnie.fuhr.org (view raw or flat)
Thread:
Lists: 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

In response to

pgsql-novice by date

Next:From: Michael FuhrDate: 2006-01-24 21:50:06
Subject: Re: default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
Previous:From: Luis SilvaDate: 2006-01-24 17:51:37
Subject: pl/pgsql switch

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