Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2005
    Posts
    127

    Question Unanswered: Concatenation of Null Values

    Hi,

    I ve a varchar variable(say Var1 ) which may be not initialized or may have a null value., when i concatenate this variable with any other varchar variable (say Var2 = 'SAMPLE') which has a valid string as a value., the result obtained is null.

    ie.,

    result = var1 || var2 returns null to result

    In DB2 is there anything similar to SQL Server's

    SET CONCAT_NULL_YIELDS_NULL { ON | OFF }

    this option when set to OFF returns the non null string and returns null when set to ON.

    Regards
    Sn

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Do not know of any such config parm ..

    You can do coalesce(var1,'')||coalesce(var2,'')

    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Apr 2005
    Posts
    127
    Thanks for the reply Sathyaram, I ve plenty of such concatenations and hence the usage of COALESCE will be tedious, is there any other work around.

    Sn

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •