简体   繁体   中英

Getting 'ORA-00907: missing right parenthesis', cannot find error

After running my script in Oracle I am getting the error code 'ORA-00907: missing right parenthesis'. I have already created the client and employee tables, both of which ran correctly and added the tables alright. However I am getting an issue creating my 'Appointment' table. The code for creating it is below:

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))

Cannot find where the error is and cannot find any troubleshooting guidance elsewhere for the issue. Any help would be appreciated.

you have datetime() , change it to date . Please note that datetime is invalid datatype on oracle, you need to use date or alternatively 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)
)

Diference between Date and Timestamp

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.

Reference

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