日期:2014-05-16  浏览次数:20559 次

Oracle 大表复制方案存储过程实现

procedure makePayPlayIraBakNew is
  
    v_num number;
  begin
  
  vanceinfo.gmac_log_pro.setloginfo('makePayPlayIraBakNew',
                                      '1114',
                                      '9',
                                      sysdate,
                                      'makePayPlayIraBakNew执行开始');
    v_num := 0;
    select count(1)
      into v_num
      from user_tables
     where table_name = 'GMAC_PAYPLAY_IRA_HIS';
  if(v_num > 0) then
    execute immediate 'DROP TABLE  GMAC_PAYPLAY_IRA_HIS';
  end if;
    
    execute immediate 'CREATE TABLE GMAC_PAYPLAY_IRA_HIS AS SELECT * FROM GMAC_PAYPLAY';
  
    vanceinfo.gmac_log_pro.setloginfo('makePayPlayIraBakNew',
                                      '1114',
                                      '0',
                                      sysdate,
                                      'makePayPlayIraBakNew执行成功结束');
   
  exception
    when others then
      vanceinfo.gmac_log_pro.setloginfo('makePayPlayIraBakNew',
                                        '1114',
                                        '9',
                                        sysdate,
                                        substr(sqlerrm, 1, 200));                                   
  end makePayPlayIraBakNew;
?
我的异常网推荐解决方案:oracle存储过程,http://www.aiyiweb.com/oracle-develop/177537.html