ORA-00923:使用case语句未找到FROM关键字

时间:2017-04-07 11:40:04

标签: sql oracle

我试图运行此查询,但是我收到以下错误: ORA-00923:找不到FROM关键字

select  case when  trunc( MGM.period_start_time, 'mi' ) < (trunc( MGM.period_start_time, 'hh' ) +numToDSInterval( 15, 'minute' )) 
        then trunc( MGM.period_start_time, 'hh' )
        when  trunc( MGM.period_start_time, 'mi' ) < (trunc( MGM.period_start_time, 'hh' ) +numToDSInterval( 30, 'minute' )) 
        then (trunc( MGM.period_start_time, 'hh' ) +numToDSInterval( 15, 'minute' ))
        when  trunc( MGM.period_start_time, 'mi' ) < (trunc( MGM.period_start_time, 'hh' ) +numToDSInterval( 45, 'minute' )) 
        then (trunc( MGM.period_start_time, 'hh' ) +numToDSInterval( 30, 'minute' )) 
        else (trunc( MGM.period_start_time, 'hh' ) +numToDSInterval( 45, 'minute' )) 
        end as trunc(MGM.period_start_time ,'mi') period_start_time, 
        SUM(test_date) OVER (ORDER BY TRUNC(MGM.period_start_time, 'mi') range between interval '0' minute PRECEDING and interval '60' minute following ) sum_total 
from MGM

1 个答案:

答案 0 :(得分:2)

您的错误在这里:

end as trunc(MGM.period_start_time ,'mi') period_start_time

这应该是

end as period_start_time