常用oracle資料庫函數總結

來源:互聯網
上載者:User

標籤:sql

  1. wm_concat的基本文法

    select proj_id,max(scale_valus) as scale_valus

        from(select a.proj_id,

                    wm_concat(a.scale_valu) over(partition by a.proj_id order by a.ym) as sccale_valus

                from s_proj_ees_scale a

             where a.ym between ‘201601‘ and ‘201603‘

            )

        group by proj_id;

2.case when語句(行列轉換)

   case when a.course=‘‘ then a.score end 課程

   case when a.course in(‘‘,‘‘...) then a.score end 某某

3.decode函數

   decode(除數,0,顯示1,不為零的正常運算式)

4.nvl函數

   NVL(String 1,replace_with);如果String 1為NULL,則NVL函數返回replace_with的值,否則返回原來的值(本身的值),與SQLserver中的ISNULL(String 1,replace_with)一樣。

5.substr函數

   Substr(‘Hello World‘,2,4)//返回結果為‘ello’,注意從1開始和從0開始都表示從第一個字元開始。

6.ROUND函數與TRUNC函數

   ROUND(45.926,2)=45.93

   TRUNC(45.926,2)=45.92

7.常用的SQL語句

   Insert into tablename() values();

   update tablename a set a.sal=4000 where a.ename=‘‘;

常用oracle資料庫函數總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.