sql 列检查约束不能引用其他列
sql Column check constraint cannot reference other columns
我有一个table喜欢...
> myConstriants;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER
CODE CHAR(3 CHAR)
MIN_VALUE NUMBER
MAX_VALUE NUMBER
并想添加一个约束,例如...
alter table myConstriants
add constriant LAB3_EX2_CHK2
check (min_value < max_value);
但是 sql 给了我...
ERROR at line 3:
ORA-02438: Column check constraint cannot reference other columns
如何检查 min_value 是否小于最大值?
列不能为空(MIN_VALUE 和 MAX_VALUE)
你拼错了:
alter table myConstriants add constriant LAB3_EX2_CHK2 check
(min_value < max_value);
alter table myConstriants
add CONSTRAINT LAB3_EX2_CHK2
check (min_value < max_value);
我有一个table喜欢...
> myConstriants;
Name Null? Type
----------------------------------------- -------- ----------------------------
ID NUMBER
CODE CHAR(3 CHAR)
MIN_VALUE NUMBER
MAX_VALUE NUMBER
并想添加一个约束,例如...
alter table myConstriants
add constriant LAB3_EX2_CHK2
check (min_value < max_value);
但是 sql 给了我...
ERROR at line 3: ORA-02438: Column check constraint cannot reference other columns
如何检查 min_value 是否小于最大值?
列不能为空(MIN_VALUE 和 MAX_VALUE)
你拼错了:
alter table myConstriants add constriant LAB3_EX2_CHK2 check (min_value < max_value);
alter table myConstriants
add CONSTRAINT LAB3_EX2_CHK2
check (min_value < max_value);