赞
踩
CREATE OR REPLACE PROCEDURE PRC_PUB_COMPANY_UP is
/******
VERSION : 1.0
AUTHOR : Rebirth_zhujl
CREATE_TIME : 20200513
PURPOSE : 部门组归属重新分配
***/
V_ERRCODE VARCHAR(200);
V_ERRMSG VARCHAR(300);
V_COUNT VARCHAR2(4);
V_CNT VARCHAR2(4);
V_NUM VARCHAR2(4);
begin
V_COUNT :=0;
V_CNT :=0;
V_NUM :=0;
INSERT INTO T_ETL_JOB_LOG_INFO t (T.JOB_SKID ,T.JOB_ID ,T.JOB_NAME,T.EXEC_DESC,T.JOB_DT_SKID,T.CREAT_DT,T.BRANCH_CODE,T.DATE_UPDATED,T.MODULE_NAME )
VALUES (SEQ_ETL_JOB_LOG_INFO.NEXTVAL,1,‘PRC_PUB_COMPANY_UP’,‘程序开始’,1,SYSDATE,‘ALL’,NULL,‘ETL’) ;COMMIT;
for company in (select t.*
from t_pub_company t
where t.comlevel = ‘5’
and t.validind = ‘1’
and t.comattribute not in (‘M’,‘F’)
) loop
if length(company.uppercompanycode) = 4 then
select count(1) into v_count from t_pub_company t where t.companycode=substr(company.companycode,1,4)||‘30’;
select count(1) into v_cnt from t_pub_company t where t.companycode=substr(company.companycode,1,4)||‘3000’;
if v_count=0 then
insert into t_pub_company t
( t.companycode
,t.companycname
,t.companytname
,t.companyename
,t.addresscname
,t.addresstname
,t.addressename
,t.insurercname
,t.insurertname
,t.insurerename
,t.uppercompanycode
,t.comattribute
,t.comtype
,t.centerind
,t.comlevel
,t.postcode
,t.phonenumber
,t.faxnumber
,t.manager
,t.webaddress
,t.servicephone
,t.reportphone
,t.creatorcode
,t.createtime
,t.updatercode
,t.updatetime
,t.validind
,t.remark
,t.flag
,t.shortcname
,t.shorttname
,t.shortename
,t.taxnumber
,t.email
,t.printpolicycomcode
,t.printinvoicecomcode
,t.channel_code
,t.platformcode
,t.runstatus
,t.businessreplydate
,t.bpermitcomcode
,t.businesslicense
,t.bpermitstartdate
,t.bpermitenddate
,t.blicensestartdate
,t.blicenseenddate
,t.provincecode
,t.citycode
,t.countrycode)
values( substr(company.companycode,1,4)||‘30’
,(SELECT COMPANYCNAME||’(本部)’
FROM T_PUB_COMPANY tt
WHERE tt.VALIDIND = ‘1’
and tt.comattribute not in (‘M’,‘F’)
and length(tt.companycode)=4
and tt.companycode= company.uppercompanycode)
,company.companytname
,company.companyename
,company.addresscname
,company.addresstname
,company.addressename
,company.insurercname
,company.insurertname
,company.insurerename
,substr(company.companycode,1,4)
,‘X’
,company.comtype
,company.centerind
,‘3’
,company.postcode
,company.phonenumber
,company.faxnumber
,company.manager
,company.webaddress
,company.servicephone
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。