Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: select + insert vs. insert and catching exception
Okay, here's what I was thinking about when I wrote that. Perform this
little test:
create table t1 (
pk number not null,
constraint pk1 primary key (pk)
);
create table t2 (
pk number not null,
fk number
);
alter table t2 add (
constraint fk2 foreign key (fk) references t1 (pk)
);
insert into t1 values (100);
insert into t2 values (200, 100);
update t1 set pk=999 where pk=100;
ERROR at line 1:
ORA-02292: integrity constraint (owner.FK2) violated - child record found
I admit this is adding a FK parent-child relationship. I should have been more specific (or is it more generic) in my statement. I apologize for any misunderstanding. Hey, I'm only human.
Howard J. Rogers wrote:
> "Karsten Farell" <kfarrell_at_medimpact.com> wrote in message
> news:q5Gk9.3137$lj7.78759108_at_newssvr21.news.prodigy.com...
>
>>While conceptually true, you would introduce an application problem if >>you make the phone number a PK. >>In Oracle, you cannot modify the value of a PK.