I have table A in Oracle that has a primary key (id). I need to insert data into this table.
How do I prevent duplicate rows?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the id column is marked as the PK you will not be able to insert a duplicate key, the server will throw an exception.
If you will insert duplicate data with different key – that’s a logic that you need to deal with (like putting a unique constraint on the actual data) or do a check before you insert.