begin select count(1) into v_ply_table_count
from user_tables user_t
where lower(user_t.table_name) = 'cust_temp_ply_base';
if v_ply_table_count = 0
then
execute immediate 'create table CUST_TEMP_PLY_BASE
(
C_PLY_NO nvarchar2(100),
C_ORIG_FLG int,
C_ORIG_PLY_NO nvarchar2(100),
C_PROD_NO nvarchar2(20),
C_DPT_CDE nvarchar2(100),
C_SLS_CDE nvarchar2(100),
c_oper_cde nvarchar2(100),
T_INSRNC_BGN_TM date,
T_INSRNC_END_TM date
)';
execute immediate 'alter table CUST_TEMP_PLY_BASE
add constraint PK_TEMP_PLY_PK primary key (C_PLY_NO)
using index
tablespace CRM_CLEAN
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 768K
minextents 1
maxextents unlimited
)';
end if;execute immediate 'truncate table CUST_TEMP_PLY_BASE';select count(1) into v_edr_table_count
from user_tables user_t where user_t.table_name = 'CUST_TEMP_EDR_BASE';if v_edr_table_count = 0
then
execute immediate 'create table CUST_TEMP_EDR_BASE
(
C_EDR_NO nvarchar2(100),
C_PLY_NO nvarchar2(100),
c_edr_type int
)';
execute immediate 'alter table CUST_TEMP_EDR_BASE
add constraint PK_TEMP_EDR_PK primary key (C_EDR_NO)
using index
tablespace CRM_CLEAN
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 768K
minextents 1
maxextents unlimited
)';
end if;
execute immediate 'truncate table CUST_TEMP_EDR_BASE';--导入数据--ODS批单有效数据
insert into CUST_TEMP_EDR_BASE
(
C_EDR_NO,
C_PLY_NO,
c_edr_type
)
select
edr.C_EDR_NO,
edr.C_PLY_NO,
edr.c_edr_type
from ply_info ply
left join v_core_edr_base edr
on ply.policy_no = edr.C_PLY_NO
where
(
edr.c_edr_type is null
or edr.C_EDR_TYPE = 1
or edr.c_edr_type = 2
)
and edr.c_edr_no is not null;
commit;
--导入数据--ODS保单有效数据
insert into CUST_TEMP_PLY_BASE
(
C_PLY_NO,
C_ORIG_FLG,
C_ORIG_PLY_NO,
C_PROD_NO,
C_DPT_CDE,
C_SLS_CDE,
c_oper_cde,
T_INSRNC_BGN_TM,
T_INSRNC_END_TM
)
select
base.C_PLY_NO,
base.C_ORIG_FLG,
base.C_ORIG_PLY_NO,
base.C_PROD_NO,
base.C_DPT_CDE,
base.C_SLS_CDE,
base.c_oper_cde,
base.T_INSRNC_BGN_TM,
base.T_INSRNC_END_TM
from ply_info ply
inner join v_core_ply_base base
on ply.policy_no = base.C_PLY_NO;--清除导入保单数据中注销和退保的保单
delete from CUST_TEMP_PLY_BASE ply
where ply.c_ply_no in
(
select distinct(ply_base.c_ply_no)
from
v_core_ply_base ply_base
left join v_core_edr_base edr
on ply_base.c_ply_no = edr.C_PLY_NO
where
edr.C_EDR_TYPE = 3
or
edr.c_edr_type = 4
);commit;
end;这段存储过程 如何 转换java代码 希望高人 指点 必有重谢!!!
from user_tables user_t
where lower(user_t.table_name) = 'cust_temp_ply_base';
if v_ply_table_count = 0
then
execute immediate 'create table CUST_TEMP_PLY_BASE
(
C_PLY_NO nvarchar2(100),
C_ORIG_FLG int,
C_ORIG_PLY_NO nvarchar2(100),
C_PROD_NO nvarchar2(20),
C_DPT_CDE nvarchar2(100),
C_SLS_CDE nvarchar2(100),
c_oper_cde nvarchar2(100),
T_INSRNC_BGN_TM date,
T_INSRNC_END_TM date
)';
execute immediate 'alter table CUST_TEMP_PLY_BASE
add constraint PK_TEMP_PLY_PK primary key (C_PLY_NO)
using index
tablespace CRM_CLEAN
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 768K
minextents 1
maxextents unlimited
)';
end if;execute immediate 'truncate table CUST_TEMP_PLY_BASE';select count(1) into v_edr_table_count
from user_tables user_t where user_t.table_name = 'CUST_TEMP_EDR_BASE';if v_edr_table_count = 0
then
execute immediate 'create table CUST_TEMP_EDR_BASE
(
C_EDR_NO nvarchar2(100),
C_PLY_NO nvarchar2(100),
c_edr_type int
)';
execute immediate 'alter table CUST_TEMP_EDR_BASE
add constraint PK_TEMP_EDR_PK primary key (C_EDR_NO)
using index
tablespace CRM_CLEAN
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 768K
minextents 1
maxextents unlimited
)';
end if;
execute immediate 'truncate table CUST_TEMP_EDR_BASE';--导入数据--ODS批单有效数据
insert into CUST_TEMP_EDR_BASE
(
C_EDR_NO,
C_PLY_NO,
c_edr_type
)
select
edr.C_EDR_NO,
edr.C_PLY_NO,
edr.c_edr_type
from ply_info ply
left join v_core_edr_base edr
on ply.policy_no = edr.C_PLY_NO
where
(
edr.c_edr_type is null
or edr.C_EDR_TYPE = 1
or edr.c_edr_type = 2
)
and edr.c_edr_no is not null;
commit;
--导入数据--ODS保单有效数据
insert into CUST_TEMP_PLY_BASE
(
C_PLY_NO,
C_ORIG_FLG,
C_ORIG_PLY_NO,
C_PROD_NO,
C_DPT_CDE,
C_SLS_CDE,
c_oper_cde,
T_INSRNC_BGN_TM,
T_INSRNC_END_TM
)
select
base.C_PLY_NO,
base.C_ORIG_FLG,
base.C_ORIG_PLY_NO,
base.C_PROD_NO,
base.C_DPT_CDE,
base.C_SLS_CDE,
base.c_oper_cde,
base.T_INSRNC_BGN_TM,
base.T_INSRNC_END_TM
from ply_info ply
inner join v_core_ply_base base
on ply.policy_no = base.C_PLY_NO;--清除导入保单数据中注销和退保的保单
delete from CUST_TEMP_PLY_BASE ply
where ply.c_ply_no in
(
select distinct(ply_base.c_ply_no)
from
v_core_ply_base ply_base
left join v_core_edr_base edr
on ply_base.c_ply_no = edr.C_PLY_NO
where
edr.C_EDR_TYPE = 3
or
edr.c_edr_type = 4
);commit;
end;这段存储过程 如何 转换java代码 希望高人 指点 必有重谢!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货