listagg输出乱码

listagg输出乱码:
在这里插入图片描述
select listagg(c.cer_name,’,’) within group(order by c.cer_name) from train_ygzs_rel tyr
LEFT JOIN train_certificate c ON c.cer_id = tyr.cer_id and c.sync_operate != 3
where tyr.employee_id = E.employee_id and tyr.sync_operate != 3 and tyr.EMPLOYEE_ID = 33

对输出的c.cer_name通过to_char进行转换,代码如下即解决乱码问题

select listagg(to_char(c.cer_name),',') within group(order by c.cer_name) from train_ygzs_rel tyr  
   LEFT JOIN train_certificate c ON c.cer_id = tyr.cer_id and c.sync_operate != 3 
    where tyr.employee_id = E.employee_id and tyr.sync_operate != 3 and  tyr.EMPLOYEE_ID = 33

你可能感兴趣的:(oracle)