partytimeline_lp.sql 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.partytimeline_lp()
  2. IS
  3. DECLARE
  4. p_count int
  5. BEGIN
  6. insert into shanglifeecif.partytimeline (
  7. TripID,
  8. PolicyNo,
  9. PartyID,
  10. name,
  11. PCertID,
  12. PRole,
  13. Scenario,
  14. SDate,
  15. describe,
  16. created_by ,
  17. created_time
  18. ) select
  19. reflect("java.util.UUID", "randomUUID"),
  20. trim(contno) as contno,
  21. trim(INSUREDNO) as INSUREDNO,
  22. trim(INSUREDNAME) as INSUREDNAME,
  23. trim(idno) as idno,
  24. '投保人',
  25. '理赔',
  26. CASE
  27. WHEN APPLYDATE IS NOT NULL THEN APPLYDATE
  28. WHEN APPLYDATE IS NULL THEN RPTDATE
  29. END AS SDate,
  30. trim(ACCIDENTTYPE) as ACCIDENTTYPE,
  31. 'admin',
  32. sysdate()
  33. from dsj.insurance_claim WHERE contno IS NOT NULL;
  34. dbms_output.put_line('partytimeline_lp函数跑批完成!');
  35. EXCEPTION
  36. WHEN HIVE_EXCEPTION THEN
  37. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  38. WHEN Others THEN
  39. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  40. END;