如下数据存在诸多特殊字符,需使用模糊匹配进行查找
With Test1 As
(Select ‘嫦娥5%号’ As Nam From Dual Union All
Select ‘嫦娥_5号’ As Nam From Dual Union All
Select ‘嫦娥/号’ As Nam From Dual Union All
Select ‘嫦娥5号 ’ As Nam From Dual Union All
Select ‘嫦娥5’‘号’ As Nam From Dual Union All
Select ‘嫦娥5#号’ As Nam From Dual Union All
Select ‘嫦娥5\号’ As Nam From Dual Union All
Select ‘5 号 ’ As Nam From Dual Union All
Select ‘%5号’ As Nam From Dual Union All
Select ‘_5号’ As Nam From Dual Union All
Select ‘/号’ As Nam From Dual Union All
Select ‘5号’ As Nam From Dual Union All
Select ‘=5号’ As Nam From Dual Union All
Select ‘5’‘号’ As Nam From Dual Union All
Select ‘5’’’‘号’ As Nam From Dual Union All
–Select ‘5&号’ As Nam From Dual Union All
Select ‘5#号’ As Nam From Dual)
1、查找带“ ”(空格)的值
Select * From Test1
where nam like '% %'
2、查找带“\”的值
Select * From Test1
where nam like '%\%'
3、查找带“%”的值
Select * From Test1
where nam like '%\%%' escape '\'
4、查找带“_”的值
Select * From Test1
where nam like '%\_%' escape '\'
5、查找带“=”的值
Select * From Test1
where nam like '%=%'
6、查找带“/”的值
Select * From Test1
where nam like '%/%'
7、查找带“’”(单引号)的值
Select * From Test1
where nam like '%''%'
7、查找带“’’”(双引号)的值
Select * From Test1
where nam like '%''''%'