日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle之单行函数1

發布時間:2023/12/10 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle之单行函数1 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

--全部小寫 全部大寫 全部首字母大寫 select lower('ATGUIGUJAVA'),UPPER('ATGUIGU Java'),initcap('ATGUIGU Java') from dual --

運行結果

--轉換為小寫查詢 select * from employees where lower(last_name)='king'

運行結果

字符控制函數

--拼接 截取 長度 select CONCAT('hello','world'), SUBSTR('helloworld',2,4), LENGTH('helloworld') from dual;

運行結果

--判斷字符的位置 沒有返回0 select instr('helloworld','w') from dual

運行結果

--座對齊 輸出十位 不足*號補齊 左端補齊 select employee_id,last_name,lpad(salary,10,'*') from employees;

運行結果

--在字符里面取出 去除首尾h select trim('h'from 'hhellhoworldh') from dual

運行結果

--替換所有的a select replace('abcgavc','a','c') from dual

運行結果

--保留數 select round(435.35,2),round(435.35),round(435.35,-2) from dual

運行結果

--保留數 截斷 select trunc(435.35,2),trunc(435.35),trunc(435.35,-2) from dual

運行結果

--員工工作天數 select employee_id,last_name,trunc(sysdate-hire_date) worked_days from employees;

運行結果

--員工工作月數 select employee_id,last_name,(sysdate-hire_date)/30,months_between(sysdate,hire_date) from employees;

運行結果

--加上月數2月 減去三月 下個周日 select add_months(sysdate,2),add_months(sysdate,-3),next_day(sysdate,'星期日') from dual

運行結果

--每個月倒數第二天來的員工 select last_name,hire_date from employees where hire_date=last_day(hire_date)-1

運行結果

--日期函數 按照月份 日期 select round(sysdate,'month'),round(sysdate,'mm'),trunc(sysdate,'hh') from dual

運行結果

隱式類型轉換

--轉換 select '12'+2 from dual;

運行結果

顯式轉換

--進行日期轉換 select employee_id,hire_date from employees --where hire_date='7-06月-94' where to_char(hire_date,'yyyy-mm-dd')='1994-06-07'

運行結果

--進行日期轉換 select employee_id, to_char(hire_date,'yyyy"年"mm"月"dd"日"') from employees --where hire_date='7-06月-94' where to_char(hire_date,'yyyy"年"mm"月"dd"日"')='1994年06月07日'

運行結果

--轉換 select to_char(1234567.89,'999,999,999,99') from dual;

運行結果

--員工工資 select to_char(1234567.89,'$999,999,999,99') from dual;

員工工資

總結

以上是生活随笔為你收集整理的oracle之单行函数1的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。