oracle 工作中遇到的函式

2021-09-24 10:46:25 字數 2432 閱讀 7896

--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,'女') ***  from sys_user u

select round(123.456,1)from dual;

trunc (擷取日期和數字處理)

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

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//

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'))

posted @

2016-08-15 14:50

赤子之心_timefast 閱讀(

...)

編輯收藏

工作中遇到的

今天,在工作中,發現乙個問題,簡要描述 用perl寫的cgi程式獲取表單元素的值,用獲得的值拼接sql語句,假如有個表單元素這樣寫 其中 type id 由perl寫成的同乙個cgi程式執行時寫入。另設乙個表單元素,供使用者輸入值使用 在cgi中獲得表單元素的值 my type id cgi par...

工作中遇到的問題

1.環境oracle9 vs2008 問題 aspnet提示 無法載入 dll oramts.dll 找不到指定的模組。異常來自 hresult 0x8007007e 翻來覆去折騰了好久最後終於解決方法是 執行oracle安裝檔案增加oracle windows inte ces 模組功能。糾結啊!...

工作中遇到的問題

問題背景 第二天領導要去給客戶演示專案,讓我在演示電腦上部署我們的專案。由於我們的專案的資料庫使用的是oracle 10g,但是我從來沒有進行過導資料庫和還原資料庫的操作,第一次操作都是找度娘,而且還是很迷茫。剛開始我一直想辦法在我的plsql上把資料庫匯出來,但是一直摸不到竅門,而且我們的資料庫較...