【Oracle】用check语法限制字段的输入值

建表语句:

create table defects(
    id number(4),
    code varchar2(6),
    type varchar2(10) check(type='oper' or type='sql' or type='api'),
    status number(1) check(status=0 or status=1),
    remark nvarchar2(100),
    primary key(id)
)

其中

    type varchar2(10) check(type='oper' or type='sql' or type='api'),
    status number(1) check(status=0 or status=1),

都是限制输入值的,type被限制在三值之一,status被限制在0、1两值。

END

posted @ 2021-10-19 20:41  逆火狂飙  阅读(343)  评论(0编辑  收藏  举报
生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东