单条SQL-字符排序

Posted by 道行尚浅 on January 10, 2018

将字符串’ccbdaefa’ 更改为 aabccdef 即字符串内部按照字符排序



select  listagg(c1) within  group (order by c1) col
from (
select  SUBSTR('ccbdaefa',ROWNUM,1) c1
  from dual 
  connect by level <= length('ccbdaefa') );
  
COL
----------------------------
aabccdef