如何在这里使用天花板?

时间:2012-02-21 12:37:43

标签: sql oracle

当我运行此代码时显示错误CEILING:无效的标识符请帮我在这里找到Diff_In_Secs的上限..

 select a.action, CEILING(avg(extract(minute from b.RECEIVED_TS - a.RECEIVED_TS)*60
    + extract(second from b.RECEIVED_TS - a.RECEIVED_TS))) Diff_In_Secs
    from request a, reply b where a.ID = b.ID 
and a.RECEIVED_TS > trunc(sysdate) - 10
and b.TARGET_ID is not null
group by a.ACTION
order by diff_in_secs desc;

2 个答案:

答案 0 :(得分:1)

这是你想要的吗?

select a.action, CEILING(CEILING(avg(extract(minute from b.RECEIVED_TS - a.RECEIVED_TS)*60
    + extract(second from b.RECEIVED_TS - a.RECEIVED_TS)))) Diff_In_Secs

答案 1 :(得分:0)

老问题,但我遇到了同样的问题...在我的情况下,它不喜欢CEILING;使用CEIL来使其工作。