init_customerno_salecom_relation.sql 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.init_customerno_salecom_relation() IS
  2. DECLARE
  3. BEGIN
  4. -- 用户 渠道关系表
  5. insert into shanglifeecif.customerno_salecom_relation (
  6. customerno,
  7. salecomname,
  8. salecom,
  9. gender,
  10. label1,
  11. label2,
  12. label3,
  13. label4,
  14. label9,
  15. label10,
  16. label21,
  17. Label67,
  18. Label69,
  19. Label70,
  20. Label71,
  21. Label74,
  22. label77,
  23. Label80,
  24. Label96,
  25. Label97,
  26. Label100,
  27. Label101,
  28. Label103,
  29. Label104,
  30. Label105,
  31. Label106
  32. )
  33. SELECT t.customerno , t.salecomname ,t.salecom ,i.gender , i.label1,
  34. i.label2,
  35. i.label3,
  36. i.label4,
  37. i.label9,
  38. i.label10,
  39. i.label21,
  40. i.Label67,
  41. i.Label69,
  42. i.Label70,
  43. i.Label71,
  44. i.Label74,
  45. i.label77,
  46. i.Label80,
  47. i.Label96,
  48. i.Label97,
  49. i.Label100,
  50. i.Label101,
  51. i.Label103,
  52. i.Label104,
  53. i.Label105,
  54. i.Label106 FROM (
  55. SELECT customerno , salecomname ,salecom FROM dsj.POLICY_INFORMATION GROUP BY customerno , salecomname,salecom
  56. ) t , shanglifeecif.individual i WHERE t.customerno = i.scustid ;
  57. dbms_output.put_line('insuredno_salecom_relation 函数跑批完成!');
  58. EXCEPTION
  59. WHEN HIVE_EXCEPTION THEN
  60. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  61. WHEN Others THEN
  62. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  63. END;