SQL-Oracle存储过程-循环A表,向B表插入数据
--存储过程,查询A表,向B表插入数据 create or replace procedure prc_sg_sjtj_config(p_flag out varchar2) IS BEGIN FOR c_row IN (SELECT T.UNIT_NAME, T.DATA_NAME, T.TABLE_NAME, T.UPDATE_ODR, DECODE(T.DATA_METHODS, '文件', '拷贝', '接口', '服务接口', '交换平台') AS DATA_METHODS FROM v_dataservice_ext t where t.data_type = '0' AND T.DATA_NAME NOT IN (SELECT s.msxx FROM t_sg_sjdjtj s)) LOOP INSERT INTO t_sg_sjdjtj (ywdw, ywb, msxx, ms, djfs, tjbz) VALUES (c_row.unit_name, c_row.table_name, c_row.data_name, c_row.UPDATE_ODR, c_row.DATA_METHODS, '1'); COMMIT; END LOOP; p_flag := '1'; END prc_sg_sjtj_config;