【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

原文地址:https://www.cnblogs.com/heyang78/p/15426345.html