my pgsql error?

From: Christopher Sawtell <csawtell(at)xtra(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: my pgsql error?
Date: 2001-03-13 11:53:05
Message-ID: 01031400530600.00996@berty
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Please could a kind soul help me with this.
I can't find _any_ - however cryptic - docs about plpgsql.

create function nice_date(date) returns varchar as '
declare
t alias for $1;
d text;
m text;
y text;
begin
day := rtrim(to_char(\'t\'::timestamp, \'Day\'));
month := rtrim(to_char(\'t\'::timestamp, \'DD Month\'));
year := rtrim(to_char(\'t\'::timestamp, \'YYYY\' ));
nd := d || m || y;
end;
return nd;
end;' language 'plpgsql';

It seems to load ok, but on exection I get this message.

chris=# select nice_date(date('today'));
NOTICE: plpgsql: ERROR during compile of nice_date near line 12
ERROR: parse error at or near "return"

Please, what am I doing wrong?

--
Sincerely etc.,

NAME Christopher Sawtell
CELL PHONE 021 257 4451
ICQ UIN 45863470
EMAIL csawtell @ xtra . co . nz
CNOTES ftp://ftp.funet.fi/pub/languages/C/tutorials/sawtell_C.tar.gz

-->> Please refrain from using HTML or WORD attachments in e-mails to me
<<--

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2001-03-13 12:38:22 Re: my pgsql error?
Previous Message Ken Corey 2001-03-13 10:55:47 Fwd: Silly question about numbering of rows?