X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B2424D1B523 for ; Thu, 16 Oct 2003 23:06:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02977-09 for ; Thu, 16 Oct 2003 20:06:11 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id BF57AD1B503 for ; Thu, 16 Oct 2003 20:06:08 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3777764; Thu, 16 Oct 2003 16:06:49 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Yusuf , PgSql-SQL Subject: Re: Can't convert numeric to_char() in catenate function Date: Thu, 16 Oct 2003 16:04:00 -0700 User-Agent: KMail/1.4.3 References: <20031016222416.672C5D1B4E8@svr1.postgresql.org> In-Reply-To: <20031016222416.672C5D1B4E8@svr1.postgresql.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200310161604.00195.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/196 X-Sequence-Number: 15596 Yusuf, > CREATE OR REPLACE FUNCTION "verticat" (text, numeric) RETURNS text AS ' > SELECT CASE WHEN $2 IS NULL THEN $1 > WHEN $1 IS NULL OR $1 =3D ''''=20 > THEN to_char($2,'999999999D99') > ELSE $1 || '', '' || to_char($2,'99999999D99') You need to escape your single quotes by double-quoting them, eg.: to_char($2,''99999999D99'') -Josh Berkus Aglio Database Solutions San Francisco