使用Pivot函数的Oracle错误ORA-00933(SQL命令未正确结束)

时间:2012-05-17 02:04:45

标签: sql oracle

Oracle新手,尝试执行以下语句时出现上述错误。只有在我添加底部的Pivot功能时才会发生:

select * from (
 select
   tc.tc_user_01 as "DMR",
   tc.tc_user_02 as "RFC",
   tc.tc_status as "STATUS",
   case
      when ts.ts_user_01 = '1-Critical' then 'P1'
      when ts.ts_user_01 = '2-High' THEN 'P2'
      when ts.ts_user_01 = '3-Medium' then 'P3'
      when ts.ts_user_01 = '4-Low' then 'P4'
      when ts.ts_user_01 = '5-Very Low' then 'P5'
   end as "PRIORITY"
   from  testcycl tc, test ts, cycle cy, release_cycles rcyc
   where tc.tc_test_id = ts.ts_test_id
   and tc.tc_cycle_id = cy.cy_cycle_id
   and rcyc.rcyc_id = cy.cy_assign_rcyc
   and rcyc.rcyc_name in ('16 June 2012')
   and cy.cy_cycle NOT like '00%'
   and ts_user_04 like '03%'
   and cy.cy_user_02 = 'Scott Brown')
pivot
(
 count(tc_status) for (tc_status) in ('Failed', 'No Run', 'Not Completed', 'Passed', 'Pending')
)

0 个答案:

没有答案