不确定我错过了什么来获得此错误?
Error starting at line : 95 in command -
ALTER TABLE Official_Language ADD CONSTRAINT Language_Official_Language_fk
FOREIGN KEY (language_code)
REFERENCES Language (language_code)
ON DELETE NO ACTION
ON UPDATE NO ACTION
NOT DEFERRABLE
Error report -
SQL Error: ORA-00905: missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
感谢任何帮助:-)谢谢
答案 0 :(得分:1)
ALTER TABLE Official_Language ADD CONSTRAINT Language_Official_Language_fk
FOREIGN KEY (language_code)
REFERENCES Language (language_code)
NOT DEFERRABLE;
可能的选择是ON DELETE [CASCADE | SET NULL] 默认情况下(如果省略ON DELETE),它与您编写的相同。
NOT DEFERRABLE是默认值(你也可以省略它)
答案 1 :(得分:0)
这个应该有效:
ALTER TABLE Official_Language ADD CONSTRAINT Language_Official_Language_fk
FOREIGN KEY (language_code)
REFERENCES Language (language_code)
NOT DEFERRABLE;
默认为"无操作",Oracle对删除/更新没有任何影响。
可能的关键字为ON DELETE CASCADE
或ON DELETE SET NULL
答案 2 :(得分:0)
与MySql不同,Oracle不支持ON DELETE NO ACTION
- 选项为:
ON DELETE CASCADE
(即级联删除)ON DELETE SET NULL
(如果列可为空,则将键更新为null)