0

I'm having a problem with an SQL statement. I want to activate a "ON UPDATE CASCADE" behavior for a foreign key in a table with this statement :

ALTER TABLE "DB"."RECORD" ADD CONSTRAINT "RECORD_PT_OUTIL_FK1" FOREIGN KEY ("CDE_PO")
REFERENCES "DB"."PT_OUTIL" ("CDE_PO") ON UPDATE CASCADE ENABLE;

But when i run the statement in Oracle Developer, i just get this error message : "ORA-00905 : missing keyword" I can't find what could be this missing keyword, i tried several changes but always the same error occurs. I reuse a code generated by Oracle Developer it self and just modify it with what i want. This is the generated code :

ALTER TABLE "DB"."RECORD" ADD CONSTRAINT "RECORD_PT_OUTIL_FK1" FOREIGN KEY ("CDE_PO")
REFERENCES "DB"."PT_OUTIL" ("CDE_PO") ON DELETE CASCADE DISABLE;

See, i just change the end of it. So what's the matter here ? Am i missing something ? (please don't bash if it's something obvious :) ) Thx !

2 Answers 2

1

Oracle does not support the ON UPDATE clause for foreign keys.

See the description of the REFERENCES clause in the manual:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/clauses002.htm#CJAIHHGC

Sign up to request clarification or add additional context in comments.

Comments

0

Try by removing the DISABLE/ ENABLE at the end of your command

As per the ADD CONSTRAINT reference, there doesnt seem to be any "Enable / Disable" as part of the command.

I think it is something that your Oracle Developer is adding at the end (it being part of Oracle Syntax) and it might be causing the problem!!

2 Comments

I give you the DDL generated to create the Table, maybe you'll see something weird ... :
@B1ll0u - what db engine are you using in MySQL? Is the table in question using MyISAM or InnoDB?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.