oracle字符中不包含字母,oracle中字母A或B是否包含在字符串中

drop table cs_thz_1 ;

create table cs_thz_1(   nid number(10)  ,sname varchar2(100)  ,remark varchar2(200)    ) ;

truncate table cs_thz_1;

insert into cs_thz_1(nid,sname,remark)

select 1 nid,‘小汽车‘ sname,‘A‘ remark from dual union all

select 2 nid,‘摩托‘ sname,‘MNP‘ remark from dual union all

select 3 nid,‘自行车‘ sname,‘BD‘ remark from dual union all

select 4 nid,‘拖拉机‘ sname,‘MND‘ remark from dual union all

select 5 nid,‘卡车‘ sname,‘EF‘ remark from dual union all

select 6 nid,‘起重机‘ sname,‘PX‘ remark from dual commit;

---以A或B开头

select * from cs_thz_1 where regexp_like(remark,‘^[AB]‘) ;

---以A或C结尾

select * from cs_thz_1 where regexp_like(remark,‘[CA]$‘) ;

---含A或N的字符

select * from cs_thz_1 where regexp_like(remark,‘[AN]‘) ;

---含P或E或B的字符-----这个还没解决

select t.*,case when regexp_like(remark,‘[PEB]‘) then 1 else 0 end is_del from cs_thz_1 t ;

select t.*,‘[P,E,B]‘) then 1 else 0 end is_del from cs_thz_1 t ;

select t.*,‘[PE|E|B]‘) then 1 else 0 end is_del from cs_thz_1 t ;

select t.*,‘[(PE)|E|B]‘) then 1 else 0 end is_del from cs_thz_1 t ;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值