1.建立存储过程
CREATE DEFINER=`root`@`%` PROCEDURE `p_dmk_fsyx`(v_month VARCHAR(6),v_type VARCHAR(2),OUT result INT(2))
BEGIN
IF @v_type=1 THEN
delete from dmk_fsyx_zxy_rpt where month_id=v_month;
insert into dmk_fsyx_zxy_rpt
(prov_name,
oper_code,
oper_name,
channel_id,
info_fees,
dgp_fees,
return_ratio,
sett_fees,
month_id)
select prov_name,
oper_code,
oper_name,
channel_id,
info_fees,
dgp_fees,
return_ratio,
sett_fees,
month_id
from dmk_fsyx_zxy a
join (select * from dim_fsyx_oper_type where month_id = v_month) b
on a.oper_code = b.oper_code
and a.busi_type = b.busi_type
join (select * from dim_fsyx_ch_type where month_id =