简体   繁体   中英

right parenthesis error ORA-00907 in Oracle

I have created these 2 tables. They are part of a superType of staff. When trying to create these tables in oracle I am getting the error

ORA-00907: missing right parenthesis

I'm not sure why I am getting this error. can anyone point out my mistake?

Firstaiders Table

DROP TABLE Firstaiders;
CREATE TABLE Firstaiders(
Staff_ID    NUMBER NOT NULL,

CONSTRAINT  pk_Firstaiders PRIMARY KEY (Staff_ID),

FOREIGN KEY(Staff_ID) REFERENCES Staff(Staff_ID) ON DELETE CASCADE ON   UPDATE CASCADE
);

Security Table

 DROP TABLE Security;
CREATE TABLE Security(
Staff_ID    NUMBER NOT NULL,
Security_ID NUMBER,
CRB_CHECK   VARCHAR2(8),
fk1_Stage_ID    NUMBER NOT NULL,

CONSTRAINT  pk_Security PRIMARY KEY (Staff_ID),

FOREIGN KEY(Staff_ID) REFERENCES Staff(Staff_ID) ON DELETE CASCADE ON UPDATE CASCADE
);

Remove ON UPDATE CASCADE which is not supported directly in Oracle.

For example:

CREATE TABLE Firstaiders(
Staff_ID    NUMBER NOT NULL,
CONSTRAINT  pk_Firstaiders PRIMARY KEY (Staff_ID),
FOREIGN KEY(Staff_ID) REFERENCES Staff(Staff_ID) ON DELETE CASCADE);

Oracle expects a right parenthesis after ON DELETE CASCADE but it found ON UPDATE CASCADE that's causing the ORA-00907

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM