Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Updates and primary keys...
Hi,
what is the usual way to update a table including its primary keys?
simplified example:
CustId CustNo CustName
1234 1 Abe 5678 2 Guest 90AB 3 XP CDEF 4 Zak
CustID is primary key, CustNo is unique key.
CustNo's are given after the alphabetical order of the names, so add a Customer "new" , he would get No 3 and XP would get 4.
If this is processed in a linear order we would do:
insert into customer values ('FOO',3,'New'); update customer set CustNo=4 where CustId='90AB'; update customer set CustNo=5 where CustId='CDEF';
Obviously, this will fail because the first 2 statement cause key violations.
I can think of 3 methods to handle this:
Any other ideas how to handle this? A "only check keys on commit" would be nice :)
(DB: 8.1.7)
-- Andreas if ((sex==fem)&&(hobby==comp)&&(age~25)&&(status==single) &&(cntry=GER)) goto http://www.kochandreas.com/home/single.htmReceived on Thu Apr 25 2002 - 12:19:01 CDT
![]() |
![]() |