输出SQL时间戳以仅显示部分数据

时间:2017-03-27 18:27:08

标签: sql oracle

我正在尝试输出"持续时间"时间显示在&n; 39小时:min:sec'而不是' days hours:min:sec:ms'。我想摆脱输出中的毫秒。到目前为止,这是我的代码输出:

select   to_char("ALERT"."START", 'DD-Mon-YYYY HH24:MI:SS') as "START",
"ALERT"."END_TIME" - "ALERT"."START" as "DURATION",
     "ALERT"."EVENT" as "EVENT",
     "ALERT"."DESC" as "DESC",
   "ALERT"."ACK" as "NOTES"
 from   "TABLE"."COMP" "COMP",
    "TABLE"."ALERT" "ALERT"
 where   "ALERT"."CUSTOMER" in('abc123')
 and     "ALERT"."COMP_ID"="COMP"."ID"
 and     "COMP"."COMP_ID" = 'abc'
 and     "START" >= ('01-JAN-17') and "START" < ('22-MAR-17');

这是当前的输出:

 START                         DURATION    EVENT     DESC             NOTES  
----------------------------- ----------- ---------- --------------   ------
20-Mar-2017 05:15:44          0 5:6:59.95 Some Event Some description NA

我希望&#34; DURATION&#34;输入的列(例如,&#39; 8d 5:32:22&#39;)而不是(即8d 5:32:22:956243)。

非常感谢任何帮助。

感谢。

0 个答案:

没有答案