Reputation: 1
Not sure what i'm missing to get this error?
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:
Any help is appreciated :-) Thanks
Upvotes: 0
Views: 4895
Reputation: 107247
Unlike MySql, Oracle doesn't support ON DELETE NO ACTION
- the options are:
ON DELETE CASCADE
(i.e. cascading delete)ON DELETE SET NULL
(update keys to null, if permitted by the column nullability)Upvotes: 0
Reputation: 8797
ALTER TABLE Official_Language ADD CONSTRAINT Language_Official_Language_fk
FOREIGN KEY (language_code)
REFERENCES Language (language_code)
NOT DEFERRABLE;
Possible choices are ON DELETE [CASCADE | SET NULL] By default (if you omit ON DELETE) it is the same as you have written.
NOT DEFERRABLE is default (you can also omit it)
Upvotes: 1
Reputation: 59456
This one should work:
ALTER TABLE Official_Language ADD CONSTRAINT Language_Official_Language_fk
FOREIGN KEY (language_code)
REFERENCES Language (language_code)
NOT DEFERRABLE;
Default is "no action", Oracle does not make any difference on delete/update.
Possible keywords are ON DELETE CASCADE
or ON DELETE SET NULL
Upvotes: 0