How To Add Unique Constraint On A ORACLE DB Table For Unique Rows

How To Add Unique Constraint On A ORACLE DB Table For Unique Rows

This Posts Presents  SQL Statement to Alter A Oracle DB (12c) TableTo Add Unique Constraint For Unique Rows Where Primary Keys or Unique Column Constraints Are Not There.

If Oracle DB Table Have A,B,C,D,E,F fields , then Add A Constraint On All Fields Of This Table

ALTER TABLE DUPLICATE_TEST

ADD CONSTRAINT DUPLICATE_TEST_CONSTRAINT UNIQUE (A,B,C,D,E,F)

On Entering To Duplicate Row It Will Return Below Error :

[23000][1] ORA-00001: unique constraint (DB_NAME.Table_Name) violated

Reference :

SQL Query To Find Duplicate Rows In A Oracle DB Table

https://esumit.blog/2017/10/25/sql-query-to-find-duplicate-rows-in-a-oracle-database-table/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s