Results 1 to 3 of 3

Thread: Complex Update

  1. #1
    Join Date
    Sep 2004
    Location
    Mansfield, OH
    Posts
    22

    Unanswered: Complex Update

    I am having problems developing the UPDATE portion of a MERGE statement between 2 tables. Both table A and table B contain 331 like fields, any one of which may be being updated. I only want to update the fields in table A if the corresponding field in table B has a value (is not NULL).
    Table A has a primary key, but table B may have multiple records matching the same record key in table A.
    Any help is much appreciated. I do not usually do any database development, and this is being demanded of me by management in a short timeframe (yesterday, as they say).
    Thanks.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Seomthing like:
    Code:
    SET a.col1 = NVL(b.col1,a.col1)
    ,   a.col2 = NVL(b.col2,a.col2)
    ...
    ?

  3. #3
    Join Date
    Sep 2004
    Location
    Mansfield, OH
    Posts
    22
    I never thought of it that way, but that makes sense. Thanks.

Posting Permissions

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