Re: switch statement in plpgsql

From: Godshall Michael <Michael_Godshall(at)gmachs(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: switch statement in plpgsql
Date: 2003-07-29 22:47:36
Message-ID: A596FA3368757645AF862C701495CA000138CB8F@hor1mspmx01.gmachs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am running postgresql through cygwin and it seems that the other languages
are not included in the default build. I have tried createlang plperl mydb.

It seems to execute but I never get a confirmation message that it did or
did not fail.

:-(

-----Original Message-----
From: Robert Treat [mailto:xzilla(at)users(dot)sourceforge(dot)net]
Sent: Tuesday, July 29, 2003 1:27 PM
To: Godshall Michael
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] switch statement in plpgsql

On Tue, 2003-07-29 at 12:18, Godshall Michael wrote:
> Hello,
>
> Is it possible to use a case switch statement in a plpgsql function or
> must I use If-Else statements only?
>
> If so what is the format?
>
> I have tried the following which when compiled is accepted but when I
> call the function it crashes.
>
> switch(tregion)
>
> {
>
> case : ''San Ramon'' then tregion := ''San Ramon, CA'';
>
> break;
>
> }
>

It is not currently possible in plpgsql (though I believe it is possible
in some of the other function languages).

You could probably lobby to have it put on the TODO list (I agree there
are times when it would be nice to have), though the IF...ELSIF..ELSE
construct can usually serve the same purpose.

Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

Browse pgsql-novice by date

  From Date Subject
Next Message Stephan Szabo 2003-07-29 23:48:54 Re: help: now() + N is now failing!
Previous Message Dmitry Tkach 2003-07-29 22:36:57 Re: help: now() + N is now failing!