Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Primary key
I'm not really sure what you're asking. ORACLE would not make fieldz part of the primary key unless it were not null. You could add the column, populate it so that the combination of x,y,z would be unique, alter table modify z not null, and then drop the current primary key and define a new one using all 3 fields.
The only consequence is that now you have a 3 field PK instead of a 2 field. Any application code would have to be modified to take that into account.
-- Jim Gregory Principal Consultant for Keane, Inc. Currently assigned to NCR "Opinions are my own and do not reflect those of Keane or my clients" Lim Chin Yee <ccelimcy_at_nus.edu.sg> wrote in message news:3447D7F0AFD4D011AE0400608C14CE561F3C638D_at_pfs01.ex.nus.edu.sg...Received on Wed Aug 23 2000 - 11:56:24 CDT
> Table A's primary key is made up of 2 fields( fieldx and fieldy)
> If i were to add in a new field(fieldz) and make it a primary key as
> well,
> what are the consequences?
>
> consequences that i've thought of.
> 1. since fieldz is of null value, existing data cannot be validated
> since the constraints cannot work.
>
>
>
> p.s: all 3 fields shld be NON-NULL
>
> TIA
>