2017-04-07 60 views
-1

我試圖運行此查詢,但我得到以下錯誤:ORA-00923:從關鍵字找不到預期的地方ORA-00923:從關鍵字找不到預期使用case語句

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 

回答

2

你的錯誤是在這裏:

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

這也許應該是

end as period_start_time 
+0

,工程...謝謝 – aaru