我怀疑好像是最后一个语句有问题:
AND (case when T01.update_date is null then case when T08.update_date is null then 0 else 1 end else 1 end) = 1 但是在SQLPlus中和自已单独写的PHP程序中能正常执行,
只是在我的正式代码中不能通过,会出现以下错误:
ORA-00920: invalid relational operator

解决方案 »

  1.   

    刚才又查了一下,如果把上面的代码写在一行上放到SQLPlus里执行,也会出现ORA-00920: invalid relational operator的错误,
    如果要是折行,也就是说像上面那样的格式输入到SQLPlus中执行就没有问题了。为什么呢?
    难道说PHP里执行SQL语句,对SQL语句的长度有限制吗?
    如果有限制的话,为什么在单独写的PHP代码里却能执行呢?请高手们指点迷津~~~~!!!!!!
      

  2.   

    阿,不是很懂Oracle的……,也没有环境来调试……这个SQL的问题,你应该在Oracle版去问问吧
      

  3.   

    不懂Oracle,这么多AND 会不会影响效率啊?
      

  4.   

    真NB,写得出这么复杂的代码
    你都怀疑是最后一句有问题了,那还不容易,先把最后一句去掉看有没有问题
    如果还有问题,慢慢去掉一些,直到没有问题
    如果没有问题了,把其它的条件全去掉,只留这一句,慢慢把这一句调试出来
    如果怀疑太长了有问题,建议换个可以适应你这么长的
    嗯,或者你自己想办法简化下啊,
    application.application_id这个取个别名我看就短很多了
      

  5.   

    先去掉AND (case when T01.update_date is null then case when T08.update_date is null then 0 else 1 end else 1 end) = 1 
    试试
      

  6.   

    去掉AND (case when T01.update_date is null then case when T08.update_date is null then 0 else 1 end else 1 end) = 1 
    试了,好用
    就是不知道这句为什么出错。
      

  7.   

    我把错误信息打出来了,大家帮看看是什么原因。ERROCODE:ORA-00972: identifier is too long
      

  8.   

    那你把
    AND (case when T01.update_date is null then case when T08.update_date is null then 0 else 1 end else 1 end) = 1 
    改为
    AND (case when T01.update_date is null then case when T08.update_date is null then 0 else 1 end else 1 end)
    试试
      

  9.   

    真没用过这么复杂的sql语句不过觉楼上楼上说得有点道理AND 两边应该是表达式的值。
      

  10.   

    是不是设计有问题真没用过这么复杂的sql语句