Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenataion and Null

Status
Not open for further replies.

mcauliff

Programmer
Feb 26, 2007
71
US
I have a select statement coded (extract below), 1 of the columns has a null value. When this happens the concatenation is all null. How do I check for null and bypass?

Select line1 || line2 || line3 || line4
from a.table
where date = '2007-06-20'

line4 is null.
 

Try:
Code:
Select Line1 || Line2 || Line3 || Line4
  From A.Table
 Where Date = '2007-06-20'
   And Line4 Is Not Null
[3eyes]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Thank forthe response. But as I researched Line2, line 3 and Line 4 may be Null.

I resolve using this

Line1 || IfNull(Line2,' ') || IfNull(Line3,' ') || IfNull(Line4,' ')
 
Personally I use the "VALUE" clause a lot (being a COBOL programmer it reliefs you from fiddling around with NULL-IMDICATORS all the time).

So I should code
Code:
value(line1 , ' ') || value(line2, 0 )  ect
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top