Problem with an SQL statement
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开发者_如何学Python 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 !
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
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!!
精彩评论