select *
  from t006
 where cp001 = '03'
   and cp002 || cp003 || to_char(ip001) in
       (select cp002 || cp003 || to_char(ip001)
          from t002
         where cp001 = '03'
           and cn029 = '财务部'
           and lower(cp006) = 'y');

解决方案 »

  1.   

    (select cp002 || cp003 || to_char(ip001)
              from t002
             where cp001 = '03'
               and cn029 = '财务部'
               and lower(cp006) = 'y');----这一步建临时表,然后建索引 
    /*+parallel(t 3)*/---是并行t为表t006的别名
    select /*+parallel(t 3)*/ * 
      from t006  t
     where cp001 = '03'
       and cp002 || cp003 || to_char(ip001) in
      

  2.   

    谢谢whx20081(),如果不通过创建临时表有没有比较好的优化方法。我是程序中嵌套sql语句。