zoukankan      html  css  js  c++  java
  • Oracle 排序

    按拼音排序

    select * from perexl order by nlssort(danwei,'NLS_SORT=SCHINESE_PINYIN_M'); 

    按部首排序

    select * from perexl order by nlssort(danwei,'NLS_SORT=SCHINESE_STROKE_M'); 

    按笔画排序

    select * from perexl order by nlssort(danwei,'NLS_SORT=SCHINESE_RADICAL_M'); 

    排序后获取第一行数据

    select * from (select * from perexl order by nlssort
    (danwei,'NLS_SORT=SCHINESE_PINYIN_M') )C where rownum=1 

     

    nulls始终放在最前

     select * from perexl order by danwei nulls first 

    nulls始终放在最后

     select * from perexl order by danwei desc nulls last 

    decode函数比nvl函数更强大,同样它也可以将输入参数为空时转换为一特定值

     select * from perexl order by decode(danwei,null,'单位是空', danwei) 

    标准的rownum分页查询使用方法

     select *from (select c.*, rownum rn from personnel c)where rn >= 1and rn <= 5 

     

    Oracle语句rownum对Oracle 排序分页的解决方案

    但是如果, 加上order by 姓名 排序则数据显示不正确

    select *from (select c.*, rownum rn from personnel c order by 出生年月)where rn >= 1and rn <= 5

    解决方法,再加一层查询,则可以解决

    select *from (select rownum rn, t.*from (select 姓名, 出生年月 from personnel order by 出生年月 desc) t)where rn >= 1and rn <=

  • 相关阅读:
    自解压命令学习
    浅谈JAVA中的final修饰符
    clearfix清除浮动进化史
    HTML5本地存储Localstorage
    Log4j详细使用教程
    AutoCompleteTextView与MultiAutoCompleteTextView应用
    冒泡排序
    方法的递归
    枚举类型
    ThinkJs笔记琐碎
  • 原文地址:https://www.cnblogs.com/luxd/p/6222532.html
Copyright © 2011-2022 走看看