select a,b from table
order by (case when a is null then 0 else 1 end),nvl(length(trim(b)),0);
a为空时自动排在最前,之后按升序排列
b按照值长度从小到大排列
order by (case when a is null then 0 else 1 end),nvl(length(trim(b)),0);
a为空时自动排在最前,之后按升序排列
b按照值长度从小到大排列

被折叠的 条评论
为什么被折叠?