Skip site navigation (1) Skip section navigation (2)

Re: string is sometimes null ?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Graeme Hinchliffe <graeme(dot)hinchliffe(at)zeninternet(dot)co(dot)uk>
Cc: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>,pgsql-general(at)postgresql(dot)org
Subject: Re: string is sometimes null ?
Date: 2004-09-30 09:26:53
Message-ID: 415BD15D.1060007@archonet.com (view raw or flat)
Thread:
Lists: pgsql-general
Graeme Hinchliffe wrote:
>>If monthcurr or username are null, the above will be null.
>>Anything || NULL => NULL.
> 
> AH! thanks sorted it now.  That is not the behaviour I would have
> expected :)
> 
> Is there a concatination operator that will not do this? IE 
> if 
> var1 || var2 || var3
> 
> and var2 is null would result in just var1var3  ?

You could use coalesce(var1,'') || coalesce(var2,'')
Or, wrap that in your own function and create your own operator.

-- 
   Richard Huxton
   Archonet Ltd

In response to

pgsql-general by date

Next:From: Katsaros Kwn/nosDate: 2004-09-30 09:32:50
Subject: Java application and SPI...(?)
Previous:From: Holger KlawitterDate: 2004-09-30 09:23:17
Subject: Re: string is sometimes null ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group