1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
SQL> create table test(col1 number, col2 number, col3 number);
Table created.
SQL> insert into test
2 select rownum, rownum +1, rownum +2 from dual connect by rownum <=5;
5 rows created.
SQL> insert into test
2 select rownum,rownum +1, rownum +7 from dual connect by rownum <=5;
5 rows created.
SQL> alter table test add constraint pk_test primary key(col1);
alter table test add constraint pk_test primary key(col1)
*
ERROR at line 1:
ORA-02437: cannot validate (SCOTT.PK_TEST) - primary key violated
SQL> alter table test add constraint pk_test primary key(col1,col2);
alter table test add constraint pk_test primary key(col1,col2)
*
ERROR at line 1:
ORA-02437: cannot validate (SCOTT.PK_TEST) - primary key violated
SQL> alter table test add constraint pk_test primary key(col1,col2,col3);
Table altered.
SQL> insert into test values(1,2,4);
1 row created.
SQL> insert into test values (1,2,4);
insert into test values (1,2,4)
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.PK_TEST) violated |
Partager