Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Reorder Primary Key - any problem?
"Mark C. Stock" <mcstockX_at_Xenquery .com> wrote in message news:<T9qdnSNcWpfHvarcRVn-tA_at_comcast.com>...
> "t53864" <t53864_at_yahoo.com> wrote in message
> news:9e76ab37.0409020505.501f06d7_at_posting.google.com...
> | I need to reorder the primary key of a table. Say,
> |
> | Primary Key (field1, field2)
> |
> | changed to:
> |
> | Primary Key (field2, field1)
> |
> | Would like to know if this creates any problem to the
> | database?
>
> sort of -- all FKs would be dropped when the PK is dropped, and then
> recreated with the new column order explicitly indicated
>
> do a little testing to see the effects
>
> ++ mcs
To clarify what Mark said if you attempt to drop a PK that is referenced by a FK Oracle will return an error and refuse to perform the drop unless you include the cascade constraints cluase. However, it is your responsibility to re-create the dropped FK references. Oracle does not automatically restore them in versions 7.0 - 9.2, and I doubt that this has changed with 10g.
If there are no FK references to the PK then this is not a consideration.
HTH -- Mark D Powell -- Received on Fri Sep 03 2004 - 08:25:26 CDT
![]() |
![]() |