Re: string is sometimes null ?

From: Holger Klawitter <lists(at)klawitter(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: string is sometimes null ?
Date: 2004-09-30 09:23:17
Message-ID: 200409301123.21773.lists@klawitter.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

> Is there a concatination operator that will not do this? IE
> var1 || var2 || var3
> and var2 is null would result in just var1var3 ?

You have to coalesce your vars before concatenating, as in

coalesce(var1,'') || coalesce(var2,'') || coalesce(var3,'')

Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFBW9CJ1Xdt0HKSwgYRAjg9AJoCA8rZYcDxsdey1neJNjysnPByagCfUIeL
CJT69fhzoIY+RG8btBrPnCA=
=YsB2
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-09-30 09:26:53 Re: string is sometimes null ?
Previous Message Graeme Hinchliffe 2004-09-30 08:46:32 Re: string is sometimes null ?