pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Yusuf <yusufad@myrealbox.com>
To: PgSql-SQL <pgsql-sql@postgresql.org>
Subject: Re: Can't convert numeric to_char() in catenate function
Date: Thu, 16 Oct 2003 16:04:00 -0700
Message-ID: <200310161604.00195.josh@agliodbs.com> (raw)
In-Reply-To: <20031016222416.672C5D1B4E8@svr1.postgresql.org>
References: <20031016222416.672C5D1B4E8@svr1.postgresql.org>

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




view thread (3+ messages)  latest in thread

Message-ID: <200310161604.00195.josh@agliodbs.com>
Permalink:  ../200310161604.00195.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200310161604.00195.josh@agliodbs.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, yusufad@myrealbox.com
  Subject: Re: Can't convert numeric to_char() in catenate function
  In-Reply-To: <200310161604.00195.josh@agliodbs.com>

* 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