ON UPDATE CASCADE
643155Nov 16 2008 — edited Nov 16 2008I 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.