Re: Can't convert numeric to_char() in catenate function - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Can't convert numeric to_char() in catenate function
Date
Msg-id 200310161604.00195.josh@agliodbs.com
Whole thread Raw
In response to Can't convert numeric to_char() in catenate function  (Yusuf <yusufad@myrealbox.com>)
List 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 BerkusAglio Database SolutionsSan Francisco



pgsql-sql by date:

Previous
From: Yusuf
Date:
Subject: Can't convert numeric to_char() in catenate function
Next
From: "2000info"
Date:
Subject: Postgres with OpenSSL