This question already has an answer here:
这个问题在这里已有答案:
- SQL constraint minvalue / maxvalue? 4 answers
- SQL约束minvalue / maxvalue? 4个答案
How can i set a column in oracle to not accept numbers above 10000 and below 0?
如何在oracle中设置一列不接受10000以上0以下的数字?
1 个解决方案
#1
3
You are looking for a check
constraint:
您正在寻找检查约束:
alter table t add constraint chk_t_col check (col >= 0 and col <= 10000);
This will prevent inserting or updating any values in the column that are not in the specified range.
这将阻止插入或更新列中不在指定范围内的任何值。
#1
3
You are looking for a check
constraint:
您正在寻找检查约束:
alter table t add constraint chk_t_col check (col >= 0 and col <= 10000);
This will prevent inserting or updating any values in the column that are not in the specified range.
这将阻止插入或更新列中不在指定范围内的任何值。