Home » RDBMS Server » Server Administration » Update of a Primary Key and Foreign Key
Update of a Primary Key and Foreign Key [message #371725] Wed, 29 November 2000 14:43 Go to next message
denise
Messages: 64
Registered: November 2000
Member
Is there a way that I can have Oracle automatically update my foreign key that references my primary key, when I update the primary key?
Re: Update of a Primary Key and Foreign Key [message #372104 is a reply to message #371725] Wed, 10 January 2001 06:33 Go to previous messageGo to next message
Sandeep Udupa
Messages: 9
Registered: January 2001
Junior Member
Use ON UPDATE CASCADE CONSTRAINT in the foreign key column table.
This will cause all the referenced row to be updated once the primary key row is updated.
Re: Update of a Primary Key and Foreign Key [message #372997 is a reply to message #371725] Wed, 21 March 2001 17:01 Go to previous message
Manoj
Messages: 101
Registered: August 2000
Senior Member
Hi Sandeep,
I saw Ur response in the faq posting regarding the Update-cascade.
I need the same task to perform. (Update Master table's Primary key, and the detail tables are updated automatically!)

But I wonder, Is there any constraint named 'On update cascade'
I know there is one for delete but what about Update
---
SQL> create table x2 (no number references master(no) on update cascade);
create table x2 (no number references master(no) on update cascade)
*
ERROR at line 1:
ORA-00905: missing keyword
---
would you mind to clarify.
Thanks
Manoj !
Previous Topic: calculating time between two events
Next Topic: Re: urgent
Goto Forum:
  


Current Time: Sun Jun 02 11:15:51 CDT 2024