且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Oracle中的字符串中查找精确的字符串匹配

更新时间:2022-03-10 23:41:43

有时,在比较字符串之前将一些内容添加到字符串中很有用,然后每个元素都采用相同的格式:

Sometimes it's useful to add something to the string before you compare it, then every element follows the same format:

with testData as
(
  select 'Read Only, Write, read only, Admin' test from dual union all
  select 'Read, Write, read only, Admin'  test from dual union all
  select 'Admin, Read Only (no), read only(see mgr), Admin' test from dual
)
select * from testData
where lower(test)||',' like '%read only,%';