CREATE OR REPLACE PROCEDURE shanglifeecif.update_partytimeline_add_salecom()
IS
BEGIN
	UPDATE shanglifeecif.partytimeline pt SET (pt.salecom,pt.salecomname) = 
	(
		SELECT t.salecom, t.salecomname FROM
		(
			SELECT 
				contno, salecom, salecomname
			FROM  dsj.policy_information t
			GROUP BY contno, salecom, salecomname
		) t WHERE t.contno = pt.policyno
 	)
	dbms_output.put_line('update_partytimeline_add_salecom 函数跑批完成！');
	EXCEPTION
		WHEN HIVE_EXCEPTION THEN 
			INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
		WHEN Others THEN
			INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
END;