我是第一次使用 oracle,我有一个名为 ExpenseReport 的表,其中存储有关费用的详细信息。
我希望 ApprUserNo 允许 Nulls IF ERStatus = 'PENDING' 任何帮助将不胜感激,我整个早上都在尝试排序
CREATE TABLE ExpenseReport
(
ERNo NUMBER(10) NOT NULL,
ERDesc VARCHAR2(255) NOT NULL,
ERSubmitDate DATE NOT NULL,
ERStatusDate DATE NOT NULL,
ERStatus VARCHAR2(8) DEFAULT 'PENDING' NOT NULL,
SubmitUserNo NUMBER(10) NOT NULL,
ApprUserNo NUMBER(10) NOT NULL CONSTRAINT BEN_Check CHECK (ERStatus LIKE('PENDING')),
UsersUserNo NUMBER(10) NOT NULL,
AssetAssetNo NUMBER(10) NOT NULL,
PRIMARY KEY (ERNo),
CONSTRAINT Check_ER_Date CHECK (ERStatusDate >= ERSubmitDate),
CONSTRAINT ERStatus_Null_Exception CHECK (IF ERStatus = 'PENDING',AppUserNo = NULLABLE),
CONSTRAINT ERStatus_Option CHECK (ERStatus = 'PENDING','APPROBED','DENIED')
)