oracle判斷是否包含字串

2021-09-03 02:34:05 字數 791 閱讀 3609

一、oracle判斷是否包含字串的方法

1、contains,contains用法如下:

select * from students where contains(address,  'beijing')
但是,使用contains謂詞有個條件,那就是列要建立索引,也就是說如果上面語句中students表的address列沒有建立索引,那麼就會報錯。

2、instr,instr的用法如下:

select * from students where instr(address, 'beijing') > 0
3、like,使用like:

select * from students where address like 『%beijing%』
二、oracle 查詢欄位不包含多個字串方法

以資料列中不包含 yf、zf、jd的字串為例,

1:

select * from table  where  order_no not like '%yf%' and order_no not like '%zf' and order_no not like '%jd%'
2、regexp_like 可以實現包含多個,在前面加上 not 就可以實現不包含功能,方法如下:

select * from table where not regexp_like(order_no,'yf|zf|jd')
方法1總是比方法2快略快

oracle判斷是否包含字串的方法

首先想到的就是contains,contains用法如下 sql view plain copy select from students where contains address,beijing 但是,使用contains謂詞有個條件,那就是列要建立索引,也就是說如果上面語句中students...

oracle判斷是否包含字串的方法

首先想到的就是contains,contains用法如下 sql view plain copy select from students where contains address,beijing 但是,使用contains謂詞有個條件,那就是列要建立索引,也就是說如果上面語句中students...

oracle 判斷字串是否包含指定內容

如何將表中的包含特殊字元的髒資料查出來?語法 instr string,substring 引數說明 第1個引數表示 必選項。將要被檢索的字串,可以是char,varchar2,nchar,nvarchar2,clob或nclob等型別 第2個引數表示 必選項。將要查詢的字串,可以是char,var...