使用SELECT *运行Oracle查询,但使用SELECT column1,column2'挂起'

时间:2014-07-25 12:21:14

标签: sql oracle

我有一个从开发人员发送给我的查询,在尝试执行它时遇到了一些神秘的问题(至少对我而言)。

SELECT h.toot_id, trunc(sysdate)
FROM  test.car_ehk h 
WHERE toot_id in
 (SELECT t.toot_id 
  FROM test.car_ehk e, 
       test.car t
  WHERE e.toot_id=t.toot_id 
    and t.toot_type_id < 8 
    and e.toot_ehk_id= 
     (SELECT max(toot_ehk_id) 
      FROM  test.car_ehk 
      WHERE toot_id = e.toot_id)
        and e.sent_lop_aeg is null 
        and t.alg_aeg <> e.sent_alg_aeg 
        and e.ehk_reply ='OK'
     )
    and toot_ehk_id =   
     (SELECT MAX(t2.TOOT_EHK_ID) 
      FROM test.car_EHK t2 
      WHERE TOOT_ID=H.TOOT_ID);

不起作用。查询只是继续运行,DBA必须杀死它。

当我将select h.toot_id, trunc(sysdate)替换为select h.*时,它可以正常工作。

怎么回事?

1 个答案:

答案 0 :(得分:-2)

对我来说听起来像是一个Oracle错误。也许看两个陈述的'解释计划'。验证一个计划中使用的任何索引,而不是另一个计划。