码迷,mamicode.com
首页 > 其他好文 > 详细

REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE

时间:2017-11-07 18:17:02      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:添加记录   lis   row   sql   www   color   ble   boa   ima   

参考:
-- 创建表
create table REGLIKE
(
  id   NUMBER(3),
  name VARCHAR2(20)
);
--添加记录
insert into REGLIKE (id, name)
values (1, ‘aaa111‘);
insert into REGLIKE (id, name)
values (2, ‘aaa222‘);
insert into REGLIKE (id, name)
values (3, ‘aaa333‘);
insert into REGLIKE (id, name)
values (4, ‘333aaa‘);
insert into REGLIKE (id, name)
values (5, ‘222aaa‘);
insert into REGLIKE (id, name)
values (6, ‘111aaa‘);
commit;
--使用
select * from reglike;
select * from reglike where regexp_like(name,‘^[a-z]‘);
select * from reglike where regexp_like(name,‘[a-z]$‘);
select REGEXP_INSTR (name,‘[a-z]{3}‘) position from reglike ;
select REGEXP_SUBSTR (name,‘[a-z]{3}‘) str from reglike ;
select REGEXP_REPLACE (name,‘[a-z]{1}‘,‘bbb‘,2,2) str from reglike ;

 

技术分享  技术分享  技术分享 技术分享 技术分享 技术分享
 

REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR,REGEXP_REPLACE

标签:添加记录   lis   row   sql   www   color   ble   boa   ima   

原文地址:http://www.cnblogs.com/tonghaolang/p/7799508.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!