日期:2014-05-17 浏览次数:20975 次
DECLARE
V_SQL VARCHAR2(32000);
BEGIN
V_SQL := 'INSERT INTO TB_TA(COUNTER0001,COUNTER0002.......COUNTER1000)
SELECT
公式1,
公式2,
......
公式10000
from
TB_BASE BASE
LEFT JOIN TB_COUNTER0001 T0001 ON T0001.A = BASE.A
LEFT JOIN TB_COUNTER0002 T0002 ON T0002.A = BASE.A
......
LEFT JOIN TB_COUNTER1000 T1000 ON T1000.A = BASE.A';
EXECUTE IMMEDIATE V_SQL;
COMMIT;
END;
DECLARE
V_INSERT VARCHAR2(32000);
V_FORMATE VARCHAR2(32000);
V_TABLE VARCHAR2(32000);
BEGIN
V_INSERT := '(COUNTER0001,COUNTER0002.......COUNTER1000)';
V_FORMATE := '公式1,公式2,......公式10000';
V_TABLE := '
LEFT JOIN TB_COUNTER0001 T0001 ON T0001.A = BASE.A
LEFT JOIN TB_COUNTER0002 T0002 ON T0002.A = BASE.A
......
LEFT JOIN TB_COUNTER1000 T1000 ON T1000.A = BASE.A';
EXECUTE IMMEDIATE 'INSERT INTO TB_TA' || V_INSERT ||
'SELECT'||
V_FORMATE ||
'from
TB_BASE BASE' || V_TABLE;
EXECUTE IMMEDIATE V_SQL;
COMMIT;
END;
DECLARE
CLOB_SQL CLOB;
BEGIN
EXECUTE IMMEDIATE CLOB_SQL;
END;