CREATE OR REPLACE PROCEDURE shanglifeecif.partytimeline_xq() -- 创建主存储过程
IS    
BEGIN
	 insert into shanglifeecif.partytimeline (
		TripID,
		PolicyNo,
		PartyID,
		name,
		PRole,
		Scenario,
		SDate,
		created_by ,
		created_time 
	) select 
   		reflect("java.util.UUID", "randomUUID"),
   		lp.contno,
   		lp.appntno,
   		 '',
   		'投保人',
   		'续期',
   		to_char(lp.confdate,'yyyy-MM-dd'),
   		'admin',
   		sysdate
	FROM dsj.ljapayperson lp WHERE lp.paycount > 1;
	dbms_output.put_line('partytimeline_xq函数跑批完成！');
	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;