Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012
    Posts
    28

    Unanswered: Error:The same row of target table "sam.target" was identified more than once for

    Data:

    Target:
    ID INVENTORY TAR_INFO
    -- --------- --------
    1 10 NULL
    2 15 NULL
    3 20 NULL

    Source:
    ID SOLD INFO
    -- ---- ----
    1 10 abc
    1 5 efg
    1 6 hij
    11 12 klm

    merge into "sam"."target" as t
    using "sam"."source" as s
    on t.id= s.id
    when matched then update
    set tar_info= info else ignore

    Error:The same row of target table "sam.target" was identified more than once for an update, delete or insert operation of the MERGE statement.. SQLCODE=-788, SQLSTATE=21506, DRIVER=4.13.111

    I know this error can be rectified if we use aggregate function, but what if i want to set "Tar_info" with particular value of "info".
    Thanks.

  2. #2
    Join Date
    Sep 2012
    Posts
    7
    I know this error can be rectified if we use aggregate function, but what if i want to set "Tar_info" with particular value of "info".
    In your case, there are three different rows in the SOURCE table matched with the same row in the TARGET table. So what do you mean by 'particular value of "info"': abc, efg or hij? What values do you expect to have in the TARGET table after executing your MERGE query?

    Peter,

Posting Permissions

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