缺少关键字错误
您好,我在尝试创建此表时收到此错误。 您能否告诉我如何在更新级联和删除集空约束上使用。
SQL> create table emp3
2 (
3 Fname varchar2(15)not null,
4 Minit char,
5 Lname varchar(15) NOT NULL,
6 Ssn char(9) NOT NULL,
7 Bdate DATE,
8 Address varchar(30),
9 Sex char,
10 Salary decimal(10,2),
11 Super_ssn char(9) not null,
12 Dno int default 1 not null,
13 CONSTRAINT employee PRIMARY KEY (ssn),
14 CONSTRAINT employeeSUPER FOREIGN KEY(Super_ssn) REFERENCES emp3(Ssn) ON UPD
ATE CASCADE ON DELETE SET NULL );
CONSTRAINT employeeSUPER FOREIGN KEY(Super_ssn) REFERENCES emp3(Ssn) ON UPDATE C
ASCADE ON DELETE SET NULL )
*
ERROR at line 14:
ORA-00905: missing keyword
Hi I am getting this error when trying to create this table. Can you please tell me how I can use on update cascade and on delete set null constraints.
SQL> create table emp3
2 (
3 Fname varchar2(15)not null,
4 Minit char,
5 Lname varchar(15) NOT NULL,
6 Ssn char(9) NOT NULL,
7 Bdate DATE,
8 Address varchar(30),
9 Sex char,
10 Salary decimal(10,2),
11 Super_ssn char(9) not null,
12 Dno int default 1 not null,
13 CONSTRAINT employee PRIMARY KEY (ssn),
14 CONSTRAINT employeeSUPER FOREIGN KEY(Super_ssn) REFERENCES emp3(Ssn) ON UPD
ATE CASCADE ON DELETE SET NULL );
CONSTRAINT employeeSUPER FOREIGN KEY(Super_ssn) REFERENCES emp3(Ssn) ON UPDATE C
ASCADE ON DELETE SET NULL )
*
ERROR at line 14:
ORA-00905: missing keyword
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Oracle 没有“ON UPDATE CASCADE”。 因此解析器期望在 UPDATE 处看到 DELETE 关键字,因为这是该位置中唯一应该跟在 ON 后面的关键字。
Oracle doesn't have "ON UPDATE CASCADE". So the parser is expecting to see the DELETE keyword where you have UPDATE, because that's the only keyword that should follow ON in that position.