Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2012
    Posts
    2

    Unanswered: check duplicate data in 2 table and update as error..

    i've 2 table called icp_customer and customer_prod. i need to insert data from icp_customer to customer_prod.

    in icp_customer contains of duplicate data.

    i used this code to check duplicate and update set as error.

    update icp_customer_e set error_code = 'XY'
    where rowid <> ( select max(rowid)
    from icp_customer b
    where b.cust_id = icp_customer.cust_id
    and b.cust_name = icp_customer.cust_name )

    that statement is right. but the problem is in customer_prod, there's a constraints that not allow the same data to be inserted.
    means that data in icp_customer already existed in customer_prod.

    how should i do to check existed data in both table to insert the data without proses aborted.

    many thanks!

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Why do you post UPDATE statement & then report problem with INSERT statement?

    how can we fix INSERT statement that we can't see; since you decided to not post it for us.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2012
    Posts
    2
    opss..sorry i didnt changed the title acct.

    so basically what i mean in here is i managed to update duplicate data in icp_customer as error 'XY'.

    but when i want to insert data from table icp_customer to customer_prod, process aborted due to data existed in customer_prod.

    so how to check duplicate between icp_customer and customer_prod and update set as error at icp_customer when duplicate is matched?

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >i've 2 table called icp_customer and customer_prod.
    I have neither of those 2 tables.
    >so how to check duplicate between icp_customer and customer_prod
    I give up.
    what criteria must be met to qualify as "duplicate between icp_customer and customer_prod"?
    Realize that I only know what you post & I'm confused as to what you have & what you desire.
    I still have no idea what columns need to be INSERT INTO CUSTOMER_PROD table.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

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