partytimeline_hf.sql 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.partytimeline_hf()
  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. cad.productno,
  20. cac.customerno,
  21. max(cac.customername),
  22. '投保人',
  23. '回访',
  24. cad.lastdealtime,
  25. CASE max(cad.actiondefguid)
  26. when '402837815c1a4fc6015c1a735351122d' then '特殊回访'
  27. when '402837815c1a4fc6015c1a735350012a' then '其他回访'
  28. when '402837815c2ff6b5015c3005e7fb0004' then '失效回访'
  29. when '402837815c2ff6b5015c3005e7fb2222' then '回执超期回访'
  30. when '402837815c2ff6b5015c3005e7fb0003' then '宽限期50天'
  31. when '402837815c2ff6b5015c3005e7fb0002' then '宽限期30天'
  32. when '402837815c1a4fc6015c1a735350012f' then '新契约回访'
  33. when '402837815c2ff6b5015c3005e7fb0001' then '续期回访'
  34. end ,
  35. 'admin',
  36. sysdate()
  37. FROM dsj.CC_ACTION_DATA cad,dsj.cc_action_customerinfo cac
  38. WHERE cac.unioncustomerid = cad.unioncustomerid AND cad.lastdealtime IS NOT null GROUP BY cad.productno,cac.customerno,cad.lastdealtime;
  39. dbms_output.put_line('partytimeline_hf函数跑批完成!');
  40. EXCEPTION
  41. WHEN HIVE_EXCEPTION THEN
  42. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  43. WHEN Others THEN
  44. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  45. END;