Received: from gl.aser.de (gl.aser.de [213.252.128.30]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2DDD5x16610 for ; Tue, 13 Mar 2001 08:13:05 -0500 (EST) (envelope-from gcg@gl.aser.de) Received: from pinguin (gcg@node66.dial.Uni-Magdeburg.DE [141.44.160.66]) by gl.aser.de (8.11.2/8.11.2/Debian 8.11.2-1) with SMTP id f2DDIJt26671; Tue, 13 Mar 2001 14:18:19 +0100 Content-Type: text/plain; charset="iso-8859-1" From: Christof Glaser Organization: gl.aser software engineering . internet service To: Christopher Sawtell , pgsql-sql@postgresql.org Subject: Re: my pgsql error? Date: Tue, 13 Mar 2001 14:19:21 +0100 X-Mailer: KMail [version 1.2] References: <01031400530600.00996@berty> In-Reply-To: <01031400530600.00996@berty> MIME-Version: 1.0 Message-Id: <01031314173500.00765@pinguin> Content-Transfer-Encoding: 8bit X-Archive-Number: 200103/253 X-Sequence-Number: 1912 On Tuesday, 13. March 2001 12:53, Christopher Sawtell wrote: > Please could a kind soul help me with this. > I can't find _any_ - however cryptic - docs about plpgsql. Click here: http://www.postgresql.org/devel-corner/docs/programmer/plpgsql.html > create function nice_date(date) returns varchar as ' > declare > t alias for $1; > d text; > m text; > y text; > begin Well, use the declared variable names instead of day, month, year: d := rtrim(to_char(\'t\'::timestamp, \'Day\')); m := rtrim(to_char(\'t\'::timestamp, \'DD Month\')); y := rtrim(to_char(\'t\'::timestamp, \'YYYY\' )); Just remove the following three lines ... > nd := d || m || y; > end; > return nd; ... and write instead: return d || m || y; > 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? There must be only one 'end;' at the, um, end of the function. Hope that helps, Christof -- gl.aser . software engineering . internet service http://gl.aser.de/ . Planckstraße 7 . D-39104 Magdeburg Tel. +49.391.7 44 77 10 . Fax +49.391.7 44 77 13 . Mobil 0177.77 92 84 3