ORACLE使用存储过程查询一张表信息存到另一张表

CREATE 
	OR REPLACE PROCEDURE RPADOWNLOADMANAGEDATA AS CURSOR C_DB IS SELECT
	SCENECODE,
	VERSION,
	MAX( UGID ) AS UGID,
	MAX( YHDM ) AS YHDM,
	MAX( XSMC ) AS XSMC,
	MAX( ORGNAME ) AS ORGNAME,
	MAX( APPPREMISE ) AS APPPREMISE 
FROM
	T_PORTAL_RPA_SCENE 
GROUP BY
	SCENECODE,
	VERSION;
BEGIN
	FOR SCENE IN C_DB
LOOP
	UPDATE RPADOWNLOADMANAGE 
	SET UGID = SCENE.UGID,
	YHDM = SCENE.YHDM,
	XSMC = SCENE.XSMC,
	ORGNAME = SCENE.ORGNAME,
	ENUMID = SCENE.APPPREMISE 
WHERE
	ROBOTID = SCENE.SCENECODE 
	AND VERSION = SCENE.VERSION;

COMMIT;

END LOOP;

END;
CALL RPADOWNLOADMANAGEDATA ( );
posted @ 2021-12-29 17:54  昨夜风雨声  阅读(33)  评论(0编辑  收藏  举报  来源