insuranceclaimthread_main.sql 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. CREATE OR REPLACE PROCEDURE shanglifeecif.insuranceclaimthread_main() -- 创建主存储过程
  2. IS
  3. BEGIN
  4. insert into shanglifeecif.insuranceclaimthread (
  5. icthreadid ,--'保险理赔Id',1
  6. crno ,--'立案号',2
  7. --companyno ,-- '公司代码',
  8. policyno ,--'保险单号 INSURANCE_CLAIM.CONTNO',3
  9. --applicantid ,--'投保人ID',
  10. --appname ,--'投保人名称',
  11. --appphone ,--'投保人手机',
  12. --appcertid ,--'投保人证件号码 INSURANCE_CLAIM.RISKDATE',
  13. cnno ,--'报案号',4
  14. losstime ,-- '损失发生时间',5
  15. --rpid ,-- '报案人',
  16. rpname ,--'报案人名称',6
  17. --rpphone ,-- '报案人电话',
  18. --lpid ,--'出险人 根据INSURANCE_CLAIM.INSUREDNO获取indid',
  19. lpscutid,--'出险人上游客户号7
  20. lpname ,-- '出险人名称',
  21. cndate ,--'报案日期 INSURANCE_CLAIM.RPTDATE',
  22. lossdescribe ,-- '损失原因 案件发生的原因:INSURANCE_CLAIM.LLOCCURREASON',
  23. crdate ,-- '立案日期 INSURANCE_CLAIM.RGTDATE',
  24. cndescribe ,--'报案描述 INSURANCE_CLAIM.ACCIDENTDETAIL',
  25. claimstatus ,--'理赔状态 案件的状态,例如:录入、已立案等',
  26. csdate ,--'理赔状态日期',
  27. relationship ,-- '报案人与出险人关系',
  28. ccno ,-- '赔案号 AUDIT_CLAIM_INSURANCE.CLMNO',
  29. ccstatus ,--'赔案状态',
  30. --ccsdate ,-- '赔案状态日期',
  31. productid ,--'险种代码 INSURANCE_CLAIM_HEALTH.RISKCODE',
  32. productname, --'险种名称 INSURANCE_CLAIM_HEALTH.RISKNAME',
  33. ccamt ,--'赔付金额 INSURANCE_CLAIM_HEALTH.realpay',
  34. --branchcode,-- '机构代码',
  35. claimcasestatus ,--'案件状态INSURANCE_CLAIM_HEALTH.LLCLAIMSTATE',
  36. accidenttype,
  37. created_by ,
  38. created_time
  39. -- updated_time,
  40. -- updated_by
  41. ) select
  42. row_number()over(),--1
  43. trim(rgtno) as rgtno,--2
  44. trim(contno) as contno,--3
  45. trim(rptno) as rptno,--报案号4
  46. trim(riskdate) as riskdate,--损失发生的时间5
  47. trim(rptorname) as rptorname,--报案人名称6
  48. trim(INSUREDNO) as INSUREDNO,--出险人 上游客户号
  49. trim(INSUREDNAME) as INSUREDNAME,
  50. trim(rptdate) as rptdate,
  51. trim(lloccurreason) as lloccurreason,
  52. trim(rgtdate) as rgtdate,
  53. trim(ACCDESC) as ACCDESC,--报案描述
  54. trim(llclaimstate) as llclaimstate,
  55. trim(auditdate) as auditdate,--审批日期
  56. trim(relationname) as relationname,
  57. trim(clmno) as clmno,--赔案号
  58. trim(llgettype) as llgettype,--赔案状态
  59. trim(riskcode) as riskcode,
  60. trim(riskname) as riskname,
  61. realpay,
  62. trim(llclaimstate) as llclaimstate,--案件状态
  63. trim(accidenttype) as accidenttype,
  64. 'admin',
  65. sysdate()
  66. from dsj.INSURANCE_CLAIM where contno is not null;
  67. -- 更新渠道字段
  68. shanglifeecif.update_insuranceclaimthread_add_salecom();
  69. dbms_output.put_line('insuranceclaimthread_main函数跑批完成!');
  70. EXCEPTION
  71. WHEN HIVE_EXCEPTION THEN
  72. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  73. WHEN Others THEN
  74. INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
  75. END;