补全aaz288 可能有问题的过程:
1 /* 2 add by weiyongle 20160623 3 失地农民补足aaz288,针对早期导出的数据(只适用于江安县) 4 经测试:江安县 江安县个体劳动者 这个单位一共2194人,成功修复 2166条 5 */ 6 PROCEDURE P_COMPL_AAZ288(PI_DRPH IN VARCHAR2, 7 PO_FHZ OUT VARCHAR2, 8 PO_MSG OUT VARCHAR2) IS 9 10 V_CNT_IC51 NUMBER(2);11 V_CNT_IC5152_TEMP_ NUMBER(2);12 V_AAZ288 IC51.AAZ288%TYPE;13 -- 该表 sjql_aac002_tmp 数据 是在 过程 p_compl_aaz288 中插入的数据(根据导入批次号caz005)14 CURSOR C_LINSHI_ IS15 SELECT * FROM SJQL_AAC002_TMP A WHERE A.CAZ005 = PI_DRPH;16 CURSOR C_IC5152_TEMP_ IS17 SELECT * FROM IC5152_TEMP_ A WHERE A.CAZ005 = PI_DRPH;18 CURSOR C_IC51 IS19 SELECT *20 FROM IC51 A21 WHERE A.AAC001 IN22 (SELECT AAC001 FROM SJQL_AAC002_TMP B WHERE B.CAZ005 = PI_DRPH)23 AND A.BAE001 = '511523';24 BEGIN25 -- 初始化26 PO_FHZ := '1';27 PO_MSG := 'pkg_sp3_sdnmsjql.p_compl_aaz288补全aaz288成功:';28 FOR V_CUR IN C_IC5152_TEMP_ LOOP29 SELECT COUNT(1)30 INTO V_CNT_IC5131 FROM IC51 A32 WHERE A.AAC001 = V_CUR.AAC00133 AND A.AAE016 = '1'34 -- altered by weiyongle 20160722 临时增加35 AND A.AAE013 LIKE '%导入%'36 and rownum = '1'37 -- AND A.AAE013 LIKE '%导入%'38 ;39 SELECT COUNT(1)40 INTO V_CNT_IC5152_TEMP_41 FROM IC5152_TEMP_ A42 WHERE A.AAC001 = V_CUR.AAC00143 and a.caz005 = PI_DRPH;44 -- 如果ic51只有一条 且 导出的excel数据也是一条,那么就认为这两条记录关联,然后对aaz288进行补全45 IF V_CNT_IC51 = V_CNT_IC5152_TEMP_ AND V_CNT_IC51 = 1 THEN46 SELECT AAZ28847 INTO V_AAZ28848 FROM IC5149 WHERE AAC001 = V_CUR.AAC00150 AND AAE016 = '1'51 -- add by weiyongle 20160722 临时增加 52 AND AAE013 LIKE '%导入%'53 and rownum = '1'54 -- AND AAE013 LIKE '%导入%'55 ;56 UPDATE IC5152_TEMP_ A57 SET A.AAZ288 = V_AAZ28858 WHERE AAC001 = V_CUR.AAC001;59 -- 没有修复成功的 查询语句 select * from IC5152_TEMP_ where aaz288 is null;60 END IF;61 END LOOP;62 EXCEPTION63 WHEN NO_DATA_FOUND THEN64 PO_FHZ := 'pkg_sp3_sdnmsjql.p_compl_aaz288_99';65 PO_MSG := '失地农民数据清理导入保存异常:' || SQLERRM;66 RETURN;67 END;