WM_CONCAT跟replace使用

WM_CONCAT和replace使用

SELECT WM_CONCAT(code_pol_formatn) FROM ref_formatn WHERE ind_rec_status = 'A' 

AND type_sitr NOT IN ('OTH', 'TERL', 'REGT') 

AND SUBSTR(type_sitr, 4, 1) = 'M' AND code_pol_region = 'MAR';

 

select 

'(''' || replace('CCDIV,MAR,MEDIV,MHDIV,MNDIV,MOWDIST,MPDIST,MSDIV,MWDIV', ',' , chr(39) || ',' ||  chr(39)) || ''')'

as team from dual;

 

结果:

('CCDIV','MAR','MEDIV','MHDIV','MNDIV','MOWDIST','MPDIST','MSDIV','MWDIV')