Question

I am trying to alter a table in Oracle's SQL*Plus I was able to create a table using the reserved word order using quotes. I was also able to add a primary key constraint. When it comes to adding the foreign key I have this error. I researched about what I could be doing wrong, but I can't find any satisfactory answer. I'll appreciate any help. THanks!

SQL> ALTER TABLE "ORDER"
  2  ADD CONSTRAINT ORDER_FK
  3  FOREIGN KEY(C_NO) 
  4  REFERENCES CUSTOMER(C_NO)
  5  ON DELETE RESTRICT;
ON DELETE RESTRICT
          *
ERROR at line 5:
ORA-00905: missing keyword
Was it helpful?

Solution

Oracle does not support "RESTRICT"

According to Oracle the options are: (1) omitting the ON DELETE (2) ON DELETE CASCADE and (3) ON DELETE SET NULL.

I believe that omitting the ON DELETE is closest to ON DELETE RESTRICT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top