Oracle 根据字符串的长度排序

select * from student s where s.sno=183 order by nvl(length(trim(s.sname)),0) asc -- 递增排序

-- nvl(attribute,default value) 当属性值为空时就将其值设默认值

-- length(attrbute) 得到字符串的长度

-- trim(attribute) 去掉字符的空格

你可能感兴趣的:(oracle)