Thread: concat returns null
I don't know if it's bug or feature but
select 'test' || null as result
returns null,
so i need to case second parameter not to concat if it is null...
select 'test' || null as result
returns null,
so i need to case second parameter not to concat if it is null...
abyss wrote: > I don't know if it's bug or feature but > select 'test' || null as result > returns null, > so i need to case second parameter not to concat if it is null... It's and SQL feature that neither specific to JDBC nor PostgreSQL. Most SQL functions return null if any of parameters is null.
<p> Hello abyss,<p>Check out the built-in function COALESCE which will do your special-casing for you<p><br /><p>Tuesday,December 18, 2007, 3:16:31 AM, you wrote:<p><br /><div><table border="0" cellpadding="1" cellspacing="2"><trvalign="top"><td style="background-color: #0000ff;" width="13"><p><span class="rvts6">></span></td><tdstyle="background-color: #ffffff;" width="1142"><p><span class="rvts7">I don't know if it'sbug or feature but </span><p><span class="rvts7">select 'test' || null as result</span><p><span class="rvts7">returnsnull, </span><p><span class="rvts7">so i need to case second parameter not to concat if it is null...</span><p><br/></td></tr></table></div><p><br /><p><br /><p><br /><p><br /><p><span class="rvts8">-- </span><p><spanclass="rvts8">Best regards,</span><p><span class="rvts8"> Andrew </span><a class="rvts9" href="mailto:drlaz@attglobal.net">mailto:drlaz@attglobal.net</a>