to_date() 字符串轉日期
select to_date('20050101','yyyyMMdd') today from dual
to_char() 將數值或日期型轉化爲字符
select to_char(12345678,'999,999,999,999') from dual;
select to_char(sysdate,'yyyy-MM-dd') from dual;
to_number() 將字符串轉化成數組
select to_number('20050101') nums from dual
replace() 函數用於替換字符串
replace(字段,舊內容, 新內容)
sys_guid() 生產隨機字符串
select sys_guid() from dual
nvl() 函數用來判空賦值
nvl(expr1,expr2) 如果第一個字段爲空,那麼顯示第二個字段的值。
統計函數
--數量統計,最大值,最小值,合計值,平均值
count()、max()、min()、sum()、avg()
decode() 根據輸入值返回一個對應值
decode(t.sex, '1', '男生', '2', '女生', '其他') as sex;
round() 對某個值進行四捨五入
-- 返回結果爲1235.47
select round(1235.466,2) from dual;