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

歡迎訪問 生活随笔!

生活随笔

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

编程问答

oracle 工作中遇到的函数

發布時間:2024/4/17 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle 工作中遇到的函数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?--decode語法 decode(條件,值1,翻譯值1,值2,翻譯值2)
??????????????? --decode(字段,比較1,值1,比較 2,值2)

?? decode((select count(1)
???????????????????????? from commnct_notification f
??????????????????????? where f.parent_id = t.notification_id),
?????????????????????? 0,
?????????????????????? 'true',
?????????????????????? 'false')

? DECODE(T.VALUE_BOOL,'0','否','1','是'),

?select decode (u.gender ,0,'男',1,'女') sex? from sys_user u

?

.Round (數值的四舍五入)

SELECT Round(123.456,1)FROM Dual;

Trunc (截取日期和數字處理)

select substr(to_char(sysdate,'yyyyMMdd'),3,6) from dual;

?

Substr (字符串的截取)

?

Substr(字符串,截取開始位置,截取長度)
Substr('HelloWorld',1,1)//返回結果為'h'*0和1都是表示截取的開始位置為第一個字符
Substr('HelloWorld',2,4)//返回結果為'Ello'

to_char(日期轉換成字符串);?

to_char(sysdate, 'yyyy/MM/dd'))? from dual;

select to_date('2004-05-07 13:23:44','yyyy-mm-dd hh24:mi:ss')??? from dual//

?

Nvl (數據表字段的判空處理)

select nvl(max(t.sort_order), 0) + 1 CODE
????? FROM PM_WBS_RELATION? t
?? WHERE T.PARENT_TASK_ID = '6D170892332141A8B5FD41676C91D6EC' ;

start with (樹遞歸)

SELECT FROM PM_TASK_OBJECT T, PM_WBS_RELATION T1
?WHERE T.TASK_ID = T1.CHILD_TASK_ID
?START WITH t1.parent_task_id = ''
??????? and t.task_status = 'planning'
CONNECT BY PRIOR t.task_id = t1.parent_task_idwg

逆向遞歸

connect by prior t.parent_id = t.notification_id\n"
?? ??? ??? ??? ?+ " start with t.notification_title like '%"
?? ??? ??? ??? ?+ vo.getNotificationTitle() + "%' ";

unill 合并 unillALL(union和union all的區別是,union會自動壓縮多個結果集合中的重復結果,而union all則將所有的結果全部顯示出來,不管是不是重復。 )

select pm.PROGRESS_PERCENTAGE progress, t.activity_name name,'上游' type
? from ENGINE_ACTIVITY t, pm_task_object pm
?where t.activity_id in
?????? (select t.from_activity_id
????????? from engine_transition t
???????? where t.to_activity_id in
?????????????? (select t.activity_id
????????????????? from ENGINE_ACTIVITY_ACTION t
???????????????? where t.action_id = '63A52773930B48EB93A14B296DD77090' and pm.task_id='63A52773930B48EB93A14B296DD77090'))
union
select pm.PROGRESS_PERCENTAGE,t.activity_name name, '下游' type
? from ENGINE_ACTIVITY t, pm_task_object pm
?where t.activity_id in
?????? (select t.to_activity_id
????????? from engine_transition t
???????? where t.from_activity_id in
?????????????? (select t.activity_id
????????????????? from ENGINE_ACTIVITY_ACTION t
???????????????? where t.action_id = '63A52773930B48EB93A14B296DD77090' and pm.task_id='63A52773930B48EB93A14B296DD77090'))

轉載于:https://www.cnblogs.com/chizizhixin/p/5772937.html

總結

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

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