Oracle SQL中的日期/时间输出(BI Publisher)

时间:2017-04-21 20:39:39

标签: sql oracle business-intelligence

我试图在oracle BI Publisher的字符串中输出日期(day / mon / yr)而没有(hr:min:sec)。我尝试了几种不同的格式化方法,但似乎没有任何效果。这是我的代码:

select   "DATA_POINT_DAILY_AVG"."DATE_OF_AVG" as "DATE_OF_AVG",
     "DATA_POINT_DAILY_AVG"."VALUE" as "DAILY_AVG_VALUE" 
 from    "TEST"."CALCULATED_DATA_POINT" "CALCULATED_DATA_POINT",
     "TEST"."DATA_POINT_DAILY_AVG" "DATA_POINT_DAILY_AVG" 
 where   "DATA_POINT_DAILY_AVG"."CALCULATED_DATA_POINT_ID"="CALCULATED_DATA_POINT"."ID"
  and    "DATA_POINT_DAILY_AVG"."SITE_ID" in ('123abc') 
   and   "DATA_POINT_DAILY_AVG"."DATE_OF_AVG" between ('01-FEB-17') and ('28-FEB-17') 
   and   "CALCULATED_DATA_POINT"."NAME" ='test_uptime'
order by "DATA_POINT_DAILY_AVG"."DATE_OF_AVG" DESC;

这是我目前的输出:

DATE_OF_AVG                         DAILY_AVG_VALUE
-------------------------------     ---------------
(2017-02-28T00:00:00.000+00:00)             100
(2017-02-27T00:00:00.000+00:00)              99
(2017-02-26T00:00:00.000+00:00)              99
(2017-02-25T00:00:00.000+00:00)              99
(2017-02-22T00:00:00.000+00:00)              99
(2017-02-21T00:00:00.000+00:00)              94
(2017-02-20T00:00:00.000+00:00)              99
(2017-02-19T00:00:00.000+00:00)              99
(2017-02-18T00:00:00.000+00:00)             100

预期产出:

DATE_OF_AVG DAILY_AVG_VALUE
----------- ---------------
28-FEB-17           100
27-FEB-17            99
26-FEB-17            99
25-FEB-17            99
22-FEB-17            99
21-FEB-17            94
20-FEB-17            99
19-FEB-17            99
18-FEB-17           100

非常感谢任何帮助。

感谢。

1 个答案:

答案 0 :(得分:0)

to_char(date_col,' DD-MON-YY')