oracle查詢不含括號(hào)及不含指定字符的方法

字號(hào):


    這篇文章主要介紹了oracle查詢不含括號(hào)及不含指定字符的方法,需要的朋友可以參考下。
    oracle查詢不含括號(hào)不含指定字符的記錄方法如下:
    with tmp_t as(
    select 1 as id,'測(cè)試4321_cs' as name from dual union all
    select 2,'測(cè)試 1200(測(cè)試版)' from dual union all
    select 3,'測(cè)試123(測(cè)試版)' from dual union all
    select 4,'測(cè)試 1212(d2)' from dual union all
    select 5,'測(cè)試 1212(d2)測(cè)試版' from dual union all
    select 6,'測(cè)試 123' from dual)
    select *
    from tmp_t
    where instr(name, '_cs') = 0
    and regexp_instr(name, '(.*)') = 0
    and regexp_instr(name, '\(.*\)') = 0
    結(jié)果為:
    其中regexp_instr為oracle支持的正則表達(dá)式函數(shù),其功能與instr相似。此處匹配了含有括號(hào)()和()的記錄。