I must concatenate 2 posts (ex. FIRSTANME and LASTNAME).
I actually do it by doing this:


If one of these is null, however the other the first is not null, I recieve null as concatenation result.
And That I want following behavior

FIRSTNAME = null and LASTNAME = "Smith" ==> 
  FIRSTANME || ' ' || LASTNAME == ' Smith'. 

How you can solve this in DB2?

Use coalesce

CONCAT( COALESCE(firstname,'') , COALESCE(lastname,'') )

Or while using || concat operator

COALESCE(firstname,'') || COALESCE(lastname,'') 

Observe that IBM recomments while using keyword concat and never the || operator.

Concat: http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2.doc.sqlref%2Ffconc.htm
Coalesce: http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2.doc.sqlref%2Ffcoal.htm