服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|数据库技术|

服务器之家 - 数据库 - Oracle - oracle查询不含括号及不含指定字符的方法

oracle查询不含括号及不含指定字符的方法

2019-12-10 15:13shichen2014 Oracle

这篇文章主要介绍了oracle查询不含括号及不含指定字符的方法,需要的朋友可以参考下

oracle查询不含括号不含指定字符的记录方法如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
with tmp_t as(
select 1 as id,'测试4321_CS' as name from dual union all
select 2,'测试 1200(测试版)' from dual union all
select 3,'测试123(测试版)' from dual union all
select 4,'测试 1212(D2)' from dual union all
select 5,'测试 1212(D2)测试版' from dual union all
select 6,'测试 123' from dual)
select *
 from tmp_t
where instr(name, '_CS') = 0
 and regexp_instr(name, '(.*)') = 0
 and regexp_instr(name, '\(.*\)') = 0

结果为:
oracle查询不含括号及不含指定字符的方法

其中regexp_instr为Oracle支持的正则表达式函数,其功能与instr相似。此处匹配了含有括号()和()的记录。

延伸 · 阅读

精彩推荐