日期:2014-05-17 浏览次数:21145 次
CREATE OR REPLACE PROCEDURE gettaskdone AS
v_sql VARCHAR2(2000);
BEGIN
v_sql := 'INSERT INTO t3 ';
FOR i IN (SELECT ywlb, xmlx, colname FROM t1 WHERE ywlb = '001') LOOP
v_sql := v_sql
------解决方案--------------------
'SELECT lsh, grbjh, djrq,'
------解决方案--------------------
i.ywlb
------解决方案--------------------
','
------解决方案--------------------
i.xmlx
------解决方案--------------------
','
------解决方案--------------------
i.colname
------解决方案--------------------
' FROM t2 WHERE '
------解决方案--------------------
i.colname
------解决方案--------------------
' IS NOT NULL UNION ALL';
END LOOP;
v_sql := substr(v_sql, 1, length(v_sql) - 9);
dbms_output.put_line(v_sql);
EXECUTE IMMEDIATE v_sql;
END gettaskdone;