0
當我使用檢查約束時,爲什麼我的命令不起作用?不包括支票時可以添加表格。Oracle SQL檢查錯誤
create table Car (
CarID number(32,0) NOT NULL ,
PurchaseDate date,
Colour varchar2(10) NOT NULL CHECK (Colour IN ("Red", "Blue", "Green")),
CONSTRAINT CAR_PK PRIMARY KEY (CarID),
FOREIGN KEY (CarID) REFERENCES Vehicle(ID)
);
Error report -
SQL Error: ORA-02438: Column check constraint cannot reference other columns
02438. 00000 - "Column check constraint cannot reference other columns"
*Cause: attempted to define a column check constraint that references
another column.
*Action: define it as a table check constriant.
嘗試購買日期的日期而purchaseDate日期 – psj01
日期心不是問題,而不是雙引號的狀態文字的 – Tyberius
使用單引號。 –