123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- CREATE OR REPLACE PROCEDURE shanglifeecif.init_insurancearrangement_policy_information()
- IS
- BEGIN
- INSERT INTO shanglifeecif.insurancearrangement(
- iaid ,
- policyno ,
- pindate ,
- pmdate ,
- norenewal ,
- payment ,
- applicantscustid ,
- appname ,
- appcertid ,
- insuredscustid ,
- insname ,
- inscertid ,
- productid ,
- productname,
- policybelong ,
- payendyear ,
- policystate,
- prem,
- sumprem,
- Risk,
- NPDate,
- PADate,
- pisdate,
- AgentOrg,
- schannel,
- schannelname,
- salecomname,
- POService,
- PWComp,
- security ,
- agrmntage ,
- salesperson,
- SPName,
- renewalDate,
- created_by ,
- created_time
- )
- SELECT
- row_number()over(),
- trim(CONTNO) as CONTNO,
- trim(CVALIDATE) as CVALIDATE,
- trim(ENDDATE) as ENDDATE,
- PAYCOUNT,
- trim(PAYINTV) as PAYINTV,
- trim(CUSTOMERNO) as CUSTOMERNO,
- trim(NAME) as NAME,
- trim(IDNO) as IDNO,
- trim(insuredno) as insuredno,
- trim(INSUREDNAME) as INSUREDNAME,
- trim(INSUREDIDNO) as INSUREDIDNO,
- trim(RISKCODE) as RISKCODE,
- trim(RISKNAME) as RISKNAME,
- trim(SALECOM) as SALECOM,
- PAYENDYEAR,
- trim(APPFLAG) as APPFLAG,
- prem,
- sumprem,
- AMNT,
- trim(PAYTODATE) as PAYTODATE,
- trim(polapplydate) as polapplydate,
- trim(SIGNDATE) as SIGNDATE,
- trim(AGENTCOM) as AGENTCOM,
- trim(SALECHNL) as SALECHNL,
- trim(SALECHNLNAME) as SALECHNLNAME,
- trim(salecomname) as salecomname,
- trim(PRESERVATIONFLAG) as PRESERVATIONFLAG,
- "上海人寿上海分公司",
- trim(security) as security,
- case
- when security ='终身' then 42720
- when security = '至100周岁' then 36500
- when security = '至80周岁' then 29200
- when security = '70年' then 25550
- when security = '至70周岁' then 25550
- when security = '至65周岁' then 23725
- when security = '至60周岁' then 21900
- when security = '30年' then 10950
- when security = '20年' then 7300
- when security = '10年' then 3650
- when security = '6年' then 2190
- when security = '5年' then 1825
- when security = '1年' then 365
- when security = '180天' then 180
- when security = '6月' then 180
- when security = '90天' then 90
- when security = '3月' then 90
- when security = '1月' then 30
- when security = '30天' then 30
- when security = '15天' then 15
- when security = '7天' then 7
- end,
- trim(AGENTCODE) as AGENTCODE,
- trim(AGENTNAME) as AGENTNAME,
- trim(paytodate) as paytodate,
- 'admin',
- sysdate()
- FROM dsj.policy_information;
-
- UPDATE shanglifeecif.insurancearrangement a SET (
- pano ,
-
-
-
-
-
- agentchannel
- ) = (
- select
- trim(b.PRTNO) as PRTNO,
-
-
-
-
-
- trim(b.SELLTYPE) as SELLTYPE
- from dsj.INSURANCEINFO b
- where b.contno = a.policyno
- ) WHERE 1=1 ;
- dbms_output.put_line('init_insurancearrangement_policy_information函数跑批完成!');
- EXCEPTION
- WHEN HIVE_EXCEPTION THEN
- INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
- WHEN Others THEN
- INSERT INTO shanglifeecif.exception_log(log_id,log_code,log_msg,log_time) VALUES (to_char(sysdate(),'yyyyMMddHHmmss'),sqlcode(),sqlerrm(),sysdate());
- END;
|