标签:
CREATE OR REPLACE PROCEDURE y_p_test ASBEGINdrop_table(‘y_test‘);EXECUTE IMMEDIATE ‘ create table y_test (id number, name varchar2(20)) ‘;FOR i IN (SELECT/*+driving_site(b) */ * FROM small_tab_local a, big_tab_remote@remote bWHERE a.sub_id=b.sub_id AND a.acc_id=b.acc_id)LOOPINSERT INTO y_test VALUES i;END LOOP;COMMIT;END;
create or replace procedure drop_table(x varchar2) astable1 number;beginselect COUNT(*) INTO table1 from user_tables where table_name=upper(x);if table1 > 0then execute immediate ‘drop table ‘||x;end if;end;/CREATE OR REPLACE PROCEDURE y_p_test0ASBEGINdrop_table(‘y_test‘);EXECUTE IMMEDIATE ‘create table y_test as select * from fzt_dd where 1=2‘;END;/CREATE OR REPLACE PROCEDURE y_p_test ASBEGINFOR i IN (SELECT * FROM fzt_dd WHERE ROWNUM<10)LOOPINSERT INTO y_test VALUES i;END LOOP;COMMIT;END;/CREATE OR REPLACE PROCEDURE y_p_test1 ASBEGINEXECUTE IMMEDIATE ‘begin y_p_test0; end;‘;EXECUTE IMMEDIATE ‘begin y_p_test; end;‘;END;/
标签:
原文地址:http://www.cnblogs.com/highroom/p/e7a99102c034cfdb4bdded46543aaaed.html