Re: Question about functions

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Manley, Jim'" <JMANLEY(at)Trnsworld(dot)com>
Cc: "'pgadmin-support(at)postgresql(dot)org'" <pgadmin-support(at)postgresql(dot)org>
Subject: Re: Question about functions
Date: 2002-04-03 16:14:15
Message-ID: FED2B709E3270E4B903EB0175A49BCB1293342@dogbert.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support


> -----Original Message-----
> From: Manley, Jim [mailto:JMANLEY(at)Trnsworld(dot)com]
> Sent: 03 April 2002 17:01
> To: 'dpage(at)pgadmin(dot)org'
> Subject: Question about functions
>
>
> Hi Dave,

Hi Jim,

Please use the pgadmin-support(at)postgresql(dot)org list for future support
issues.

> I am having a problem developing advanced functions in
> pgAdmin. I want to do something like this:
>
> CREATE FUNCTION get_city (varchar) RETURNS varchar
> AS '
>
> DECLARE
>
> vLastName ALIAS FOR $1;
> vCity VARCHAR;
>
> BEGIN
> SELECT city INTO vCity
> FROM customer
> WHERE last_name = vLastName;
>
> END; '
>
> language 'sql';
^^^

Your code is plpgsql so the parser doesn't understand it when you specify it
as sql (kinda like writing C++ in Microsoft Visual Basic).

Specify plpgsql as the language and you should be OK (note, this isn't
installed by default with PostgreSQL, you may need to run the createlang
script on your server).

Regards, Dave.

Browse pgadmin-support by date

  From Date Subject
Next Message Tim Finch, FosterFinch Ltd 2002-04-03 20:29:21 Re: SQL query editor
Previous Message Dave Page 2002-04-03 15:56:07 Re: SQL query editor