Results 1 to 3 of 3

Thread: trim nullvalues

  1. #1
    Join Date
    Aug 2004
    Location
    Berlin, Germany
    Posts
    12

    Unanswered: trim nullvalues

    Hi,

    i try a mapping with a lookup table to update a column.

    Code:
    update table1 x
              set x.col1 = (select y.col2 from table2 y
                                where trim(x.a_old) = trim(y.a_new) 
                                  and trim(x.b_old) = trim(y.b_new)
                               )
    where x.col1 is null;
    unfortunately the columns x.b_old and y.b_new can be null and then i get no match.
    why can i not match trim(null) = trim(null)? is there a solution? I could use a case but that would lower performance.

    lento

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    What happens if you add NVL to B_OLD and B_NEW columns? Something like
    Code:
    and trim(nvl(x.b_old, 'xxx')) = trim(nvl(y.b_new, 'xxx'))

  3. #3
    Join Date
    Aug 2004
    Location
    Berlin, Germany
    Posts
    12
    thank you, works that way

Posting Permissions

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