partytimeline_bq.sql 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.partytimeline_bq()
  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. i.contno,
  20. i.customerno,
  21. max(i.name),
  22. '投保人' AS tbr,
  23. '保全' AS bq,
  24. l.edorappdate,
  25. max(lm.edorname),
  26. 'admin',
  27. sysdate()
  28. FROM dsj.lpedoritem l,dsj.lmedoritem lm,dsj.policy_information i
  29. WHERE l.edortype = lm.edorcode AND lm.appobj <> 'G' AND l.edorstate = '0' AND i.contno = l.contno
  30. GROUP BY i.customerno,i.contno,l.edorappdate,l.edortype;
  31. dbms_output.put_line('partytimeline_bq函数跑批完成!');
  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