From: | Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz> |
---|---|
To: | David Mulcahy <eseol(at)mersinet(dot)co(dot)uk> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: pl/pgsql function problem |
Date: | 2001-09-07 23:06:45 |
Message-ID: | 999904006.12217.31.camel@kant.mcmillan.net.nz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Sat, 2001-09-08 at 01:09, David Mulcahy wrote:
> I am having problems doing what seems to be a very simple thing. All I
> need is to join 2 or more variables (eg char, int, date) and return them
> as a single varchar variable.
>
> eg ret := int + char + date; or better still join("+", int,char,date)
> return ret;
Use COALESCE( VALUE, ...) to replace nulls with default values - it will
return the first non-null argument from the list of values.
Older versions of PL/PGSQL will always return null if any argument to
the function is null, so you may have to use this where you _call_ the
function, rather than within the function.
Regards,
Andrew.
--
_____________________________________________________________________
Andrew McMillan, e-mail: Andrew @ catalyst . net . nz
Catalyst IT Ltd, PO Box 10-225, Level 22, 105 The Terrace, Wellington
Me: +64(21)635-694, Fax:+64(4)499-5596, Office: +64(4)499-2267xtn709
From | Date | Subject | |
---|---|---|---|
Next Message | Vijay Deval | 2001-09-09 05:06:43 | Re: Importing an ASCII file |
Previous Message | David Mulcahy | 2001-09-07 13:09:36 | pl/pgsql function problem |