Oracle 分割
方法1
select T.DHPAY_ID,
T.ORDERNO,
trim(REGEXP_SUBSTR(ORDERNO, ‘[^,]+’, 1, level)) ORDERNO
from (select d.DHPAY_ID, d.ORDERNO
from FUND_PAYMENT_DHPAY d
where d.response_code = ‘01’
and d.insertdate >= to_date(‘2019-06-01’, ‘yyyy-mm-dd’)) T
connect by INSTR(ORDERNO, ‘,’, 1, level - 1) > 0;
方法2
select to_char(t.insert_date, ‘yyyy-mm-dd’) as dateno,
count(distinct substr(t.order_no,
instr(’,’ || t.order_no, ‘,’, 1, rn),
instr(t.order_no || ‘,’, ‘,’, 1, rn) -
instr(’,’ || t.order_no, ‘,’, 1, rn))) payfororder
from (select p.ORDERNO order_no, p.insertdate insert_date, b.rn
from FUND_PAYMENT_DHPAY p,
(select rownum rn from dual connect by rownum <= 100) b
where instr(’,’ || p.orderno, ‘,’, 1, rn) > 0
and p.insertdate >= to_date(‘2020-06-01’, ‘yyyy-mm-dd’)
and p.insertdate < to_date(‘2020-06-11’, ‘yyyy-mm-dd’)) t
group by to_char(t.insert_date, ‘yyyy-mm-dd’)
order by to_char(t.insert_date, ‘yyyy-mm-dd’);