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