CREATE OR REPLACE PROCEDURE SYNFINANCIALDATA AS COUNTT NUMBER; BEGIN
-----------------------1.TESTTABLE01数据同步------------------------ BEGIN SELECT COUNT(*) INTO COUNTT FROM TABS WHERE TABLE_NAME='TESTTABLE01' || TO_CHAR(SYSDATE,'YYYY'); IF(COUNTT=0) THEN EXECUTE IMMEDIATE 'CREATE TABLE TESTTABLE01' || TO_CHAR(SYSDATE,'YYYY') || ' AS SELECT * FROM TESTTABLE WHERE 1=2'; END IF; EXECUTE IMMEDIATE 'DELETE FROM TESTTABLE01' || TO_CHAR(SYSDATE,'YYYY'); COMMIT; EXECUTE IMMEDIATE 'MERGE INTO TESTTABLE01' || TO_CHAR(SYSDATE,'YYYY') ..... COMMIT; END; -----------------------1.TESTTABLE02数据同步------------------------ BEGIN SELECT COUNT(*) INTO COUNTT FROM TABS WHERE TABLE_NAME='TESTTABLE02' || TO_CHAR(SYSDATE,'YYYY'); IF(COUNTT=0) THEN EXECUTE IMMEDIATE 'CREATE TABLE TESTTABLE02' || TO_CHAR(SYSDATE,'YYYY') || ' AS SELECT * FROM TESTTABLE WHERE 1=2'; END IF; EXECUTE IMMEDIATE 'DELETE FROM TESTTABLE02' || TO_CHAR(SYSDATE,'YYYY'); COMMIT; EXECUTE IMMEDIATE 'MERGE INTO TESTTABLE02' || TO_CHAR(SYSDATE,'YYYY') ..... COMMIT; END;