Date/time Oracle 中的输出 SQL (BI Publisher)
Date/time output in Oracle SQL (BI Publisher)
我正在尝试在 oracle BI Publisher 的字符串中输出没有 (hr:min:sec) 的日期 (day/mon/yr)。我尝试了几种不同的格式化方法,但似乎没有任何效果。这是我的代码:
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
如有任何帮助,我们将不胜感激。
谢谢。
to_char(date_col, 'DD-MON-YY')
我正在尝试在 oracle BI Publisher 的字符串中输出没有 (hr:min:sec) 的日期 (day/mon/yr)。我尝试了几种不同的格式化方法,但似乎没有任何效果。这是我的代码:
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
如有任何帮助,我们将不胜感激。
谢谢。
to_char(date_col, 'DD-MON-YY')