tags:

views:

14

answers:

1

Hi, I can identify the error message that its due to unique value constraint, my table is 'branches',and where did SYS_C004023 come. I have checked the branches table and there is no value duplication. What could be the issue.

A: 

where did SYS_C004023 come

This is a system-generated constraint name, which Oracle creates when a constraint is created without being explicitly named e.g.

create table mytable (col1 integer primary key);

The primary key constraint on mytable will be system-generated since I didn't explicitly name it like this:

create table mytable (col1 integer constraint mytable_pk primary key);

You can find out what table this constraint is on like this:

select table_name
from all_constraints
where owner = 'HR'
and constraint_name = 'SYS_C004023';

And you can find out which columns it makes unique like this:

select column_name
from all_cons_columns
where owner = 'HR'
and constraint_name = 'SYS_C004023';

there is no value duplication

No, there won't be, thanks to the constraint. What there has been is a failed attempt to insert or update a row so that the uniqueness constraint is violatedd.

Tony Andrews
Thanks very much for the answer, its like i copied some 10-20 records from mysql table to oracle...and the primary ids where from 1-20. But, i have added sequence also, starting from 1, so i think, that made the issue, when i truncated everything and inserted again and it worked...whew..
unni