Managing Constraints   «Prev 

Constraint Added with Exceptions Into

To create a unique constraint, just replace the primary key clause with unique. When you attempt to create a unique index on a table that already has data in it, the command will fail if any duplicates exist. If the create unique index statement succeeds, any future attempt to insert (or update) a row that would create a duplicate key will fail and result in this error message

ERROR at line 1:
ORA-00001: unique constraint (BOOKSHELF_AUTHOR.BA_PK) violated

The AUCTION_ID table contains a duplicate a value in the AUCTION_ID column.

A PRIMARY KEY constraint is added to the AUCTION_ID column with the EXCEPTIONS INTO clause.

The ROWID of the offending row is written to the EXCEPTIONS table, along with other identifying information.