Home » RDBMS Server » Server Administration » Update primary key value
Update primary key value [message #53242] Fri, 06 September 2002 06:03 Go to next message
NP
Messages: 1
Registered: September 2002
Junior Member
Hi,
Which is better to change the primary key?
- delete current row, and insert a new row
- update the primary key value of the row inserted initially.

The second one seems to be more efficient. My question is whether it can any side effects. We use database replication provided by Oracle. Will this be affected in any way. Also, this is a Java application and we would like to keep the application vendor independent as much as possible. Do all databases allow update of the primary key? is this a SQL standard?

Thank you.
Re: Update primary key value [message #53246 is a reply to message #53242] Fri, 06 September 2002 10:11 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Deleting the current row and inserting a new value will cause problems if you have foreign keys, as will updating the PK. You should rather select a new PK from your table columns (usually not possible) or consider adding a new column populated by a sequence number generator.

http://www.orafaq.net/msgboard/sql/messages/15728.htm
Previous Topic: ORA-03212: Temporary Segment cannot be created in locally-managed tablespace
Next Topic: User Profiles, please help
Goto Forum:
  


Current Time: Fri Sep 20 00:52:31 CDT 2024