Search Postgresql Archives

Re: coalesce for null AND empty strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ferdinand Gassauer wrote:
> Hi!
> 
> it would be great to have a coalesce2 function which treats empty strings as 
> null values.

I think

 COALESCE(NULLIF(value1, ''), value2)

does what you want. You could wrap that in a new function coalesce2 if
you like.

-- 
Alban Hertroys
alban@xxxxxxxxxxxxxxxxx

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux