当前位置: 代码迷 >> Oracle管理 >> 求教这样的ORACLE字段约束怎么写
  详细解决方案

求教这样的ORACLE字段约束怎么写

热度:10   发布时间:2016-04-24 05:23:30.0
求教这样的ORACLE字段约束如何写
要求字段长度=11,且头3个字符必须为139、138、136,这样ORACLE字段约束如何写

------解决方案--------------------
create table test(x varchar2(100), 
constraint chk_xx check(length(x) = 11 and substr(x, 1, 3) in ('139', '139', '136'))
);
  相关解决方案