oracle判断是否包含字符串的方法

首先想到的就是contains,contains用法如下:

[sql] view plain copy
 
  1. select * from students where contains(address,  'beijing')  


但是,使用contains谓词有个条件,那就是列要建立索引,也就是说如果上面语句中students表的address列没有建立索引,那么就会报错。

好在我们还有另外一个办法,那就是使用instr,instr的用法如下:

[sql] view plain copy
 
  1. select * from students where instr(address, 'beijing') > 0  


另外,还有个笨办法,那就是使用like,说到这里大家应该知道怎么做了吧:

[sql] view plain copy
 
    1. select * from students where address like '%beijing%'  
原文地址:https://www.cnblogs.com/telwanggs/p/8876453.html