一>基礎代碼檢查 檢查以bm_開頭的系統初始化編碼表是否有空值。與業務系統相關的編碼項不能存在空值,會導致系統業務無法辦理。爲初始化數據表、在做測試數據和正式上線前檢查。上線運行後、仍存在空值表、需要進行覈實、可能存在不經常辦理的業務。也可能是冗餘表。 PL/SQL代碼塊: declare v_table_name varchar(40); v_sql_str varchar(4000):=' '; v_cnt smallint:=0 ; v_jgbm varchar(10):='01%'; cursor tmp_cur is select table_name from user_tables where table_name like 'BM_%' ; begin open tmp_cur ; loop fetch tmp_cur into v_table_name ; exit when tmp_cur%notfound; select count(*) into v_cnt from user_tab_columns where table_name=v_table_name and column_name='JGBM'; if v_cnt<>0 then v_sql_str:='select count(*) from '||v_table_name||' where jgbm='''||v_jgbm||''''; else v_sql_str:='select count(*) from '||v_table_name; end if; execute immediate v_sql_str into v_cnt; if v_cnt=0 then insert into tmp_hfsc_sy40_chk(ywms) values(v_table_name||'表記錄爲空'); end if; commit; end loop; close tmp_cur; end; 二>財務業務覈對 業務關於資金的結算都是自動生成憑證,財務和業務應是保持一致的。如存在特殊業務可能會有不平衡的情況。如果有人調整數據也會造成不平。主要檢查 歸集餘額、單位未分配金額、貸款餘額、逾期貸款、業務流水金額和財務憑證金額是否相等。直接影響到系統的報表業務和財務的一致性。 PL/SQL代碼塊: declare v_fpzd smallint; v_ztbh number(20); v_cwnd smallint; v_kmye number(18,2); v_gjye number(18,2); v_jgbm varchar(10):='01%'; v_msg varchar(100); v_ret smallint:=0; begin select nvl(max(value1),0) into v_fpzd from bm_xtcs where bm1=v_jgbm and bm2='0301' and bm3='03010903' and bm='04' and sfqy=1; for a in(select id from cw_ztml where ztxz='01' and jgbm=v_jgbm) loop select max(nd) into v_cwnd from cw_nd where ztbh=a.id; select nvl(sum(nce+ljdf-ljjf),0) into v_kmye from cw_kmbh where kmbh='201' and ztbh=a.id and nd=v_cwnd; select v_kmye+nvl(sum(fl.dffse-fl.jffse),0) into v_kmye from cw_pz_fl fl inner join cw_pz_ml b on fl.pzid=b.pzid where kmbh like '201%' and b.ztbh=a.id and b.nd=v_cwnd and b.zfbz=0; if v_fpzd<>0 then select nvl(sum(dwzhye),0) into v_gjye from gjzf_dw_zz where jgbm=v_jgbm; else select nvl(sum(zckye+dwzhye),0) into v_gjye from gjzf_dw_zz where jgbm=v_jgbm; end if; if v_kmye<>v_gjye then insert into tmp_hfsc_sy40_chk(ywms) values(to_char(a.id)||'賬套'||'201科目餘額與業務歸集餘額不一致'); end if; commit; end loop; end;
Oracle的PL/SQL編程基礎技能實戰一
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.