日期:2014-05-17 浏览次数:20951 次
declare cursor cc is select distinct substr(vc_mobileno,1,3) trd from dw_foxuser_det order by 1; rec_ind number; ccrec cc%rowtype; begin select count(*) into rec_ind from user_table where table_name = upper('tp_20120807_a01'); if (rec_ind <> 0) then Execute immediate 'drop table tp_20120807_a01 purge'; Execute immediate 'create table tp_20120807_a01 (test varchar2(11))'; end if; for ccrec in cc loop insert into tp_20120807_a01 select vc_mobileno from dw_foxuser_det_138 where substr(vc_mobileno,4,3) = ccrec.trd; commit; end loop; End;