问题:需要将A表中的B字段里包含下列内容的值全部删掉需要删除的内容:对象契约的发送日为2018年05月01日。/证券番号
其中证券番号为可变的11位字符

解决方案 »

  1.   

    replace(b,'对象契约的发送日为2018年05月01日。/a^z','')   
      

  2.   


    with tab1 as (
    select 'aabbccddeeff' src from dual union all
    select 'aabbccddeeffgggggggggggggg'  from dual
    ),
    tab2 as (
    select 'bb' str from dual union all
    select 'ee' from dual union all
    select 'ff' from dual
    )
    , tab3 as (
    select src, result_ from tab1 t1, tab2 t2
    where 1 = 1
      and instr(t1.src, t2.str) > 0
    model
    partition by (src)
    dimension by (row_number() over(partition by t1.src order by t1.src) rn)
    measures (str, src result_)
    rules(result_[rn] = regexp_replace(nvl(result_[cv() - 1], result_[cv()]), str[cv()])
    )
    )
    , tab4 as (
    select src, row_number() over(partition by t1.src order by length(result_)) rn, result_ from tab3 t1
    )
    select * from tab4 t1
    where t1.rn = 1
    ;