【Oracle】【29】根据字段的长度排序

正文:

select * from student s order by nvl(length(trim(s.sname)),0) asc 
-- nvl(attribute, default value) 当属性值为空时就将其值设默认值

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

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

参考博客:

Oracle ==>SQL 查询根据字符串的长度排序_清水绿草_新浪博客
http://blog.sina.com.cn/s/blog_451f5962010164mv.html

原文地址:https://www.cnblogs.com/huashengweilong/p/11343134.html