2
votes

When I'm run this code getting error saying,

SQL Error: ORA-00905: missing keyword 00905. 00000 - "missing keyword"

*Cause:
*Action: Running it on ORACLE. Not sure how to fix it.

CREATE TABLE LAB4 (
  ROOMID1 NUMBER(8) NOT NULL,
  BUILDING1 VARCHAR2(25) NOT NULL,
  ROOMNO1 VARCHAR2(25) NOT NULL,
  CONSTRAINT ROOMPK1 PRIMARY KEY(ROOMID1));

CREATE TABLE BOOKING (
  BOOKINGID NUMBER(4) NOT NULL ,
  DAYOFWEEK CHAR(15) NOT NULL,
  TIMEOFDAY CHAR(8) NOT NULL,
  DURATION VARCHAR2(20)NOT NULL,
  UNITCODE NUMBER(8)NOT NULL,
  ROOMID NUMBER(4) NOT NULL, 
  CONSTRAINT BOOKINGPK PRIMARY KEY(BOOKINGID),
  CONSTRAINT LABFK FOREIGN KEY(ROOMID)
    REFERENCES LAB(ROOMID)
     ON UPDATE NO ACTION
    ON DELETE NO ACTION
  );
1
The table is called LAB4, but you are referencing LAB.GolezTrol

1 Answers

2
votes

ON UPDATE NO ACTION ON DELETE NO ACTION is definitely not Oracle syntax.

Please check out the appropriate Oracle documentation (according to the version you are using - you didn't provide an Oracle version number).

The only allowed options in latest Oracle versions are:

ON DELETE CASCADE / ON DELETE SET NULL