Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle Primary key Update

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Consider a table created in Oracle- Dept_tbl with dept_code as the primary key. Now, a row is inserted into the table with dept_code = 001.

Can the primary key be updated with some other non-existent value in the table? Does Oracle provide for this?
 
Primary key cannot be updated. It can only be inserted. It is managed by Oracle itself.

Helena
 
I have double-checked this and have to disagree. You *can* update a primary key if the new value does not exist in the table. It is not recommended as good database design however if it is a high maintenance field.
 
You are right, there must be good database design for avoiding updating of primary key.
 
Of course a primary key can be updated. The only requirement is that the new value be unique and that it falls within the contraints assigned. However, I do agree that it is best to avoid an updating on a primary key.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top