Re: Can't convert numeric to_char() in catenate function

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Yusuf <yusufad(at)myrealbox(dot)com>, PgSql-SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Can't convert numeric to_char() in catenate function
Date: 2003-10-16 23:04:00
Message-ID: 200310161604.00195.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Yusuf 2003-10-16 23:26:06 Re: Can't convert numeric to_char() in catenate function
Previous Message 2000info 2003-10-16 22:53:12 Postgres with OpenSSL