Re: Reorder Primary Key - any problem?

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 3 Sep 2004 06:25:26 -0700
Message-ID: <2687bb95.0409030525.1ab808f6_at_posting.google.com>


"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 - 15:25:26 CEST

Original text of this message