0

Wonder how to rewrite REGEXP_SUBSTR function should it can return correct value for

select REGEXP_SUBSTR('110001,|A1|1|||||N,A1,1,,,,,N,2T BBA HF LOW COST,HOME FINANCING-i',
                     '[^,]+', 
                      1, 
                      11) 
 from dual

expected result: HOME FINANCING-i

4

1 回答 1

0

您需要调整模式以匹配两个逗号之间的空白([^,]*)(,|$)

with t1(col) as(
  select '110001,|A1|1|||||N,A1,1,,,,,N,2T BBA HF LOW COST,HOME FINANCING-i'
    from dual
)
select regexp_substr(col, '([^,]*)(,|$)', 1, 11, 'i', 1) as res
  from t1

结果:

RES            
----------------
HOME FINANCING-i 
于 2013-09-23T17:32:03.127 回答