DECLARE
BEGIN 
DBMS_OUTPUT.put_line(to_char(systimestamp,'yyyy-mm-dd hh24:mi:ss.ff3'));   
 for rec16 in (select distinct fd.cc from A fd where
                           fd.y='Y' and  fd.d='20090218'
                           and fd.cc
                            in (
                            SELECT distinct FH.cc FROM B  FH
                                                     where FH.NAME ='BM'
                                                                and  FH.action in ('A','B','C','D','E')
                                                                and FH.times between to_date('2009-02-18 08:30:00', 'yyyy-mm-dd hh24:mi:ss')
                                                                and to_date('2009-02-19 08:30:00', 'yyyy-mm-dd hh24:mi:ss')
                                                                and  fh.cc is not null))loop
                    DBMS_OUTPUT.put_line(to_char(systimestamp,'yyyy-mm-dd hh24:mi:ss.ff3'));   
             end loop;
             DBMS_OUTPUT.put_line(to_char(systimestamp,'yyyy-mm-dd hh24:mi:ss.ff3'));   
END ;
               效率很低 基本上要5秒多。
                A表 3000多条记录。
                B表 30万记录。
                 请问各老大有没有办法可以优化。