查询可在 Oracle 11g 上运行,但在 Oracle 8i 上失败

Query works on Oracle 11g but fails on Oracle 8i(查询可在 Oracle 11g 上运行,但在 Oracle 8i 上失败)
本文介绍了查询可在 Oracle 11g 上运行,但在 Oracle 8i 上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Oracle 11g 中运行此查询没有问题:

I am running this query in Oracle 11g with no problem:

select (case
         when seqnum = 1 then
          '1'
         when seqnum = cnt then
          '0'
       end) as value1,
       (case
         when seqnum = 1 then
          t.BEGIN_DT
         when seqnum = cnt then
          t.END_DT
       end) as TIME1,      
       t4.UNIT1 || '.SUBBATCH_TRIGGER' TAG     
  from (select t.*,
               row_number() over(partition by t.BATCH_ID, t.plant_unit, t3.ID2 order by t.BEGIN_DT) as seqnum,
               count(*) over(partition by t.BATCH_ID, t.plant_unit, t3.ID2) as cnt
          from SCH2.tb_pg_unit_stap t
join (select ID1,batch_id from SCH2.VW_BATCH) t2 on t.BATCH_ID = t2.BATCH_ID
join (select ID2,ID1 from SCH1.STEP) t3 on t3.ID1 = t2.ID1) t
join SCH2.TB_W_MACHINE t4 on t4.plant_unit = t.plant_unit
where (seqnum = 1
    or seqnum = cnt) AND (t.BEGIN_DT > '01-jan-2013' AND t.BEGIN_DT < '01-feb-2013');

但是当我在 Oracle 8i (8.7.1) 中运行它时,它给出了 ORA-00933:SQL 命令没有正确结束.

But when I run it in Oracle 8i (8.7.1) it gives ORA-00933: SQL command not properly ended.

在 Oracle 8i 中运行 sql 命令有什么我必须知道的特殊注意事项吗?

Is there anys special consideration I must know for running sql commands in Oracle 8i?

提前致谢

推荐答案

AFAK case 命令从 9i 开始引入.

AFAK case command was introduced since 9i.

这篇关于查询可在 Oracle 11g 上运行,但在 Oracle 8i 上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

SQL to Generate Periodic Snapshots from Transactions Table(用于从事务表生成定期快照的SQL)
MyBatis support for multiple databases(MyBatis支持多个数据库)
Oracle 12c SQL: Missing column Headers in result(Oracle 12c SQL:结果中缺少列标题)
SQL query to find the number of customers who shopped for 3 consecutive days in month of January 2020(查询2020年1月连续购物3天的客户数量)
How to get top 10 data weekly (This week, Previous week, Last month, 2 months ago, 3 month ago)(如何每周获取前十大数据(本周、前一周、上个月、2个月前、3个月前))
Select the latest record for an Id per day - Oracle pl sql(选择每天ID的最新记录-Oracle pl SQL)