在 Oracle 中运行脚本后,我收到错误代码“ORA-00907:缺少右括号”。我已经创建了客户表和员工表,它们都运行正确并且添加了正确的表。但是,我在创建“预约”表时遇到问题。创建它的代码如下:
create table Appointment
(appointment_num number(9) not null primary key,
appointment_time datetime(),
emp_ID number(4) not null references employee (emp_ID),
client_ID number(9) not null references client (client_ID))
无法找到错误所在,也无法在其他地方找到该问题的任何故障排除指南。任何帮助将不胜感激。
最佳答案
您有datetime()
,请将其更改为date
。请注意,datetime
在 Oracle 上是无效数据类型,您需要使用 date
或 timestamp
create table Appointment
(
appointment_num number(9) not null primary key,
appointment_time date,
emp_ID number(4) not null references employee (emp_ID),
client_ID number(9) not null references client (client_ID)
)
日期
和时间戳
之间的差异
One of the main problems with the DATE datatype was its' inability to be granular enough to determine which event might have happened first in relation to another event. Oracle has expanded on the DATE datatype and has given us the TIMESTAMP datatype which stores all the information that the DATE datatype stores, but also includes fractional seconds.
关于sql - 获取 'ORA-00907: missing right parenthesis' ,找不到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54347351/