Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Primary Key Exceptions ??
How do you set up and use Constraint Exceptions?
create table tst_exc (
id varchar2(10));
table created
create table tst (
id varchar2(10), CONSTRAINT pk_tst_id PRIMARY KEY (id) EXCEPTIONS INTO tst_exc); *
(I don't understand why this does not work.)
(So I created the table then added the PK Constraint)
SQL>create table tst (id varchar2(10));
Table created.
SQL>alter table tst
2 add constraint pk_tst_id PRIMARY KEY (id)
3 exceptions into tst_exc;
Table altered.
(odd, there is no complaint??)
SQL>insert into tst values('apple');
1 row created.
SQL>insert into tst values('apple');
insert into tst values('apple')
*
ERROR at line 1:
ORA-00001: unique constraint (OPS$JJURGENA.PK_TST_ID) violated
data:SQL>select * from tst_exc;
no rows selected
(What is wrong? The documentation is a little sparse on
this subject, though it seems like a rather straight forward
option)
Thanks
Joe
Oracle Release 703020200
Received on Sat Mar 07 1998 - 00:00:00 CST
![]() |
![]() |