CREATE OR REPLACE PROCEDURE shanglifeecif.update_risk_categories() -- 创建主存储过程
IS    
BEGIN
	--更新险种大类
	  UPDATE shanglifeecif.insurancearrangement a SET (
		risk_categories_name
	) = (
		select
				kindtype
		from dsj.riskkind b WHERE a.productid = b.riskcode
	) WHERE 1=1;
	dbms_output.put_line('update_risk_categories函数跑批完成！');
	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;