Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ON UPDATE CASCADE

643155Nov 16 2008 — edited Nov 16 2008
I have a question. I am creating a set of tables. I want to implement referential integrity so that when a record is updated or deleted, the results match those in the parent table. Here is a sample script of my problem:
CREATE TABLE Attachment (
attch_name VARCHAR2(30),
message_id NUMBER,
sender_id NUMBER,
CONSTRAINT attch_pk PRIMARY KEY (attch_name, message_id, sender_id),
attch_size NUMBER,
size_storage_type VARCHAR2(3),
subject VARCHAR2(50),
CONSTRAINT attch_fk FOREIGN KEY (message_id, sender_id)
REFERENCES Email_Message(message_id, sender_id) ON DELETE CASCADE ON UPDATE CASCADE <<<<<<<<<<<-------------------
);

When I try to run this in sql plus, I get the following error:
ORA-00907: missing right parenthesis

If I take away the ON UPDATE CASCADE, my statement works fine. What am I doing wrong? Preferably I want to have the constraint in the table definiton, but if I have to I can add the constraint after table definition. How come I can't find this in the Oracle SQL reference?

thanks in advance.
This post has been answered by Satish Kandi on Nov 16 2008
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 14 2008
Added on Nov 16 2008
1 comment
7,821 views