我需要获取某种介质,当天,当月(第1天-最后一天),
SQL语句如下,
select '装置产氮气' as ITEMNAME,
(
select sum(dayvalue) as dv from LLHD_GYGCVIEW t where t.point_code='ASU_E_EN2_301' and inputdate=1 group by point_code
) as DayValue,
(
select sum(dayvalue) as mv from LLHD_GYGCVIEW t where t.point_code='ASU_E_EN2_301' and inputdate between trunc(1, 'mm') and last_day(1) group by point_code
) as MonthValue
from dual
PL/SQL SQL语句如下:
select '装置产氮气' as ITEMNAME,
(
select sum(dayvalue) as dv from LLHD_GYGCVIEW t where t.point_code='ASU_E_EN2_301' and inputdate=to_date('2019-03-24','yyyy-mm-dd') group by point_code
) as DayValue,
(
select sum(dayvalue) as mv from LLHD_GYGCVIEW t where t.point_code='ASU_E_EN2_301' and inputdate between trunc(sysdate, 'mm') and last_day(sysdate) group by point_code
) as MonthValue
from dual;
在PL/SQL下运行正常,报表工具中,提示ORA-09011错误,我就奇怪了,这是怎么回事????
|