pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Sawtell <csawtell@xtra.co.nz>
To: pgsql-sql@postgresql.org
Subject: my pgsql error?
Date: Wed, 14 Mar 2001 00:53:05 +1300
Message-ID: <01031400530600.00996@berty> (raw)

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 
<<--




view thread (7+ messages)  latest in thread

Message-ID: <01031400530600.00996@berty>
Permalink:  ../01031400530600.00996@berty/
Also on:    postgresql.org/message-id/01031400530600.00996@berty

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: csawtell@xtra.co.nz
  Subject: Re: my pgsql error?
  In-Reply-To: <01031400530600.00996@berty>
  References: <01031400530600.00996@berty>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox