NoLogo
NoLogo

Reputation: 51

SQLite Syntax error

Hi I'm having a problem with one of the tables in my database. I'm loading the tables from a .txt file, when I load the database i get

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

the table below starts from line 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)
);

Upvotes: 1

Views: 343

Answers (1)

Ryan
Ryan

Reputation: 28247

Looks like the syntax on your rentutd column needs to be a little different:

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

See this sqlfiddle.

The SQLite syntax diagrams are great to figure this stuff out.

Upvotes: 1

Related Questions