oracle查詢不含括號不含指定字符的記錄方法如下:
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
結果為:
其中regexp_instr為Oracle支持的正則表達式函數,其功能與instr相似。此處匹配了含有括號()和()的記錄。