如何解决 Missing Paranthesis 错误

How do I solve the Missing Paranthesis error

我正在尝试创建 table 命令来创建关系;

create table Driver(

Driver_Licence char(15) primary key,

SSN int unique,

First_Name varchar(50) not null,

Last_Name varchar(50),

Birth_Date date DEFAULT '1900-01-01',

Hire_Date date COMMENT 'Hire_Date is the date that employee was first Hired',

State char(2),

INDEX (State),

CONSTRAINT CHK_Driver_HireDate CHECK(Hire_Date > Birth_Date)

);

但是我一直收到这个错误:

Error report -
ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:

我一直在想办法解决这个问题,但我一直无法弄清楚如何解决它。如果你们中的一位能帮助我,那将是一个很大的帮助!

我认为 Oracle 既不支持表中的内联注释也不支持索引的创建。这些需要是单独的语句。

Oracle 建议使用 varchar2() 而不是 varchar()。日期字面量应以 date:

开头
create table Driver(
    Driver_Licence char(15) primary key,
    SSN int unique,
    First_Name varchar2(50) not null,
    Last_Name varchar2(50),
    Birth_Date date DEFAULT date '1900-01-01',
    Hire_Date date,
    State char(2),
    CONSTRAINT CHK_Driver_HireDate CHECK(Hire_Date > Birth_Date)
);

comment on column driver.hire_date is 'Hire_Date is the date that employee was first Hired';

create index idx_driver_state on driver(state);

Here 是一个 db<>fiddle.