我有一個計算併發作業花費時間的sql查詢。下面是該查詢:計算花費時間的總和
SELECT
user_concurrent_program_name,
DECODE (phase_code, 'C', 'Completed', phase_code) phase_code,
DECODE (status_code,
'D', 'Cancelled',
'E', 'Error',
'G', 'Warning',
'H', 'On Hold',
'T', 'Terminating',
'M', 'No Manager',
'X', 'Terminated',
'C', 'Normal',
status_code)
AS status_code,
TO_CHAR (
to_date('2001,091,00:00:00' , 'YYYY,DDD,HH24:MI:SS')
+ (ACTUAL_COMPLETION_DATE - ACTUAL_START_DATE),
'HH24:MI:SS')
AS GECEN_SURE
FROM apps.fnd_conc_req_summary_v
WHERE phase_code = 'C' AND status_code = 'C';
這裏是幾排,當我運行它:
Initial Mass Copy Completed Normal 22:12:35
Gather Schema Statistics Completed Normal 06:13:35
Request Set FAH-KPK Fislerini Olustur Completed Normal 04:36:36
Request Set FAH-KPK Fislerini Olustur Completed Normal 04:15:18
Request Set FAH-KPK Fislerini Olustur Completed Normal 04:13:45
Request Set FAH-KPK Fislerini Olustur Completed Normal 04:10:51
我想要的是得到的所花費的時間的總和。所以我的查詢結果將如下:
Initial Mass Copy Completed Normal 22:12:35
Gather Schema Statistics Completed Normal 06:13:35
Request Set FAH-KPK Fislerini Olustur Completed Normal 17:02:36
開始通過消除查詢的時間格式 - 只是做了一些。然後使用整個事件作爲內聯視圖,並總結秒數。然後將其格式化爲HH24:MI:ss – Randy