init_indrelationship_main2.sql 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.init_indrelationship_main2( )
  2. IS
  3. DECLARE
  4. s_count int
  5. BEGIN
  6. -- 完善被保人关系
  7. /** */
  8. insert into shanglifeecif.IndRelationShip(
  9. irsid,
  10. RSType,
  11. IndID1,
  12. Name1,
  13. IDCard1,
  14. Role1,
  15. IndID2,
  16. Name2,
  17. IDCard2,
  18. Role2
  19. )SELECT reflect("java.util.UUID", "randomUUID"),
  20. CASE RSType
  21. WHEN '父母' THEN '子女'
  22. WHEN '子女' THEN '父母'
  23. WHEN '祖孙、外祖孙' THEN '祖父母、外祖父母'
  24. WHEN '祖父母、外祖父母' THEN '祖孙、外祖孙'
  25. WHEN '配偶' THEN '配偶'
  26. ELSE RSType
  27. END,
  28. IndID2,
  29. Name2,
  30. IDCard2,
  31. Role2,
  32. IndID1,
  33. Name1,
  34. IDCard1,
  35. Role1
  36. FROM shanglifeecif.IndRelationShip sis ;
  37. dbms_output.put_line('init_indrelationship_main函数跑批完成!');
  38. EXCEPTION
  39. WHEN HIVE_EXCEPTION THEN
  40. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  41. WHEN Others THEN
  42. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  43. END;