1

嗨,我的数据库中的一个表有问题。我正在从 .txt 文件加载表,当我加载数据库时,我得到

ERROR NEAR line 49: near "(": syntax error

下表从第 49 行开始

create table LEASE(
P_ID integer,
I_ID varchar2,
C_ID integer,
DATE date,
TRENT decimal(6,2),
RENTPM decimal(4,2),
RENTUTD varchar2 constraint rentutd_value (RENTUTD in ('Y','N')),
LENGTH varchar2(15),
SDATE date,
EDATE date,
NOTE varchar2(150),
G_ID integer,
A_ID integer,
constraint fkey_lea1 foreign key (P_ID) references PROPERTY(P_ID),
constraint fkey_lea2 foreign key (I_ID) references INSTITUTION(I_ID),
constraint fkey_lea3 foreign key (C_ID) references CLIENT(C_ID),
constraint fkey_lea4 foreign key (G_ID) references GUARANTOR(G_ID),
constraint fkey_lea5 foreign key (A_ID) references AGENT(A_ID),
constraint pkey_lea primary key (P_ID,I_ID,C_ID,DATE)
);
4

1 回答 1

1

看起来您的rentutd 列上的语法需要有点不同:

RENTUTD varchar2 constraint rentutd_value CHECK ( RENTUTD in ('Y','N'))

看到这个sqlfiddle

SQLite 语法图非常适合解决这些问题。

于 2012-04-19T14:33:24.350 回答