tb_customerinfo.sql 909 B

12345678910111213141516171819202122
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.tb_customerinfo() IS
  2. DECLARE
  3. BEGIN
  4. DELETE FROM shanglifeecif.tbcustomerinfo;
  5. insert into shanglifeecif.tbcustomerinfo(
  6. tbid,
  7. scustid,
  8. contno,
  9. sdate,
  10. edate,
  11. salecom,
  12. salecomname
  13. )SELECT row_number()over(),p.customerno,p.contno,p.cvalidate,t.edorappdate ,p.salecom,p.salecomname FROM dsj.lpedoritem t,dsj.policy_information p
  14. WHERE t.contno = p.contno and t.edortype='CT' AND t.edorstate = 0 ;
  15. dbms_output.put_line('tb_customerinfo函数跑批完成!');
  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 ;