init_Individual_salecom.sql 1001 B

1234567891011121314151617181920212223242526272829
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.init_Individual_salecom() IS
  2. DECLARE
  3. BEGIN
  4. -- 客户信息添加渠道
  5. --
  6. UPDATE shanglifeecif.Individual si1 SET si1.SALECOM = (
  7. SELECT t.salecoms FROM (
  8. SELECT customerno , concat_ws(',',collect_set(salecom)) AS salecoms FROM (
  9. SELECT b.customerno AS customerno ,b.salecom AS salecom FROM
  10. shanglifeecif.individual a , shanglifeecif.customerno_salecom_relation b
  11. WHERE a.scustid = b.customerno
  12. ) GROUP BY customerno
  13. ) t
  14. WHERE t.customerno = si1.scustid);
  15. dbms_output.put_line('init_Individual_salecom 函数跑批完成!');
  16. EXCEPTION
  17. WHEN HIVE_EXCEPTION THEN
  18. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  19. WHEN Others THEN
  20. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  21. END;