Link to home
Start Free TrialLog in
Avatar of chokka
chokkaFlag for United States of America

asked on

Oracle : How to identify columns involved in a Table for Unique Constraint Exception ?

Oracle : How to identify columns involved in a Table for Unique Constraint Exception ?

While trying to Insert, I am getting Exception as

ORA-00001: unique constraint (Table) violated.

Without dropping the Unique Constraint, Is it possible to Insert ?

Is there any way to Turn ON or OFF the Constraint.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

>>Oracle : How to identify columns involved in a Table for Unique Constraint Exception ?

Look in user_cons_columns for the CONSTRAINT_NAME.

select * from user_cons_columns where constraint_name='SOME_NAME';

where SOME_NAME is the constraint name in question.

>>Without dropping the Unique Constraint, Is it possible to Insert ?

Not without resolving the violation.  Constraints can be deferrable in that they are not checked until COMMIT.

>>Is there any way to Turn ON or OFF the Constraint.

You can 'disable' it but see above:  You would need to resolve the conflict before it was enabled again.  AND once disabled, all sorts of other 'bad' data can sneak in!
ASKER CERTIFIED SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chokka

ASKER

slightwv and Johnsonone , Thank you for your suggestion.

I will not disable or remove the constraint.


Thank you. This post is closed. Please dont comment further.

I have some issue with my browser and so, i am not able to Accept Solution option. I will do it later.
Avatar of chokka

ASKER

Thank you !!