partytimeline_zx.sql 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.partytimeline_zx()
  2. IS
  3. DECLARE
  4. p_count int
  5. BEGIN
  6. insert into shanglifeecif.partytimeline (
  7. TripID,
  8. PolicyNo,
  9. PartyID,
  10. name,
  11. PRole,
  12. Scenario,
  13. SDate,
  14. DESCRIBE,
  15. created_by ,
  16. created_time
  17. ) SELECT
  18. reflect("java.util.UUID", "randomUUID"),
  19. m.contnos,
  20. max(i.customerno) customerno,
  21. max(m.econtactsName) econtactsName,
  22. '投保人' AS tbr,
  23. '咨询' AS zx,
  24. m.starttime,
  25. max(m.reasonsecondname) reasonsecondname,
  26. 'admin',
  27. sysdate()
  28. from dsj.cc_record_main m
  29. LEFT JOIN dsj.policy_information i ON m.contnos = i.contno
  30. WHERE m.contnos IS NOT NULL GROUP BY m.contnos,m.starttime;
  31. dbms_output.put_line('partytimeline_zx函数跑批完成!');
  32. EXCEPTION
  33. WHEN HIVE_EXCEPTION THEN
  34. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  35. WHEN Others THEN
  36. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  37. END;