创建SQL表

时间:2014-11-01 12:39:17

标签: sql oracle ddl

我正在尝试创建下表,但Oracle告诉我关键字丢失。我看过我看不出问题的代码。请帮忙

CREATE TABLE lecture
(LectureID integer not null,
StartDate date not null,  
StartTime time not null,
EndTime time not null, 
TicketID integer not null, 
PRIMARY KEY (LectureID),
FOREIGN KEY (TicketID) REFERENCES ticket(TicketID) ON DELETE RESTRICT ON UPDATE CASCADE);

这是我得到的错误代码

ORA-00905:缺少关键字

3 个答案:

答案 0 :(得分:0)

Oracle

中没有“on update cascade”

答案 1 :(得分:0)

Oracle不支持

时间数据类型您将在oracle中有以下日期时间选项

 DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE.

有关日期时间的详细信息,请参阅: Click Here

CREATE TABLE lecture
(LectureID integer not null,
StartDate date not null,  
StartTime TIMESTAMPnot null,
EndTime TIMESTAMPnot null, 
TicketID integer not null, 
PRIMARY KEY (LectureID),
FOREIGN KEY (TicketID) REFERENCES ticket(TicketID) ON DELETE RESTRICT ON UPDATE CASCADE);

答案 2 :(得分:0)

Oracle中没有ON UPDATE和DELETE RESTRICT子句。这些是mysql选项