CREATE OR REPLACE PROCEDURE wm_jhze_chk(cpcode in char,out_cursor out sys_refcursor) as rowcount int; BEGIN delete from err_msg; delete from ls_tssb; delete from ls_tsjh; delete from ls_tssb_sum1; delete from ls_tssb_maxid; delete from ls_tssb_mindate; delete from ls_tsjh_mindate; delete from ls_tsjh_sum_xfs; delete from ls_tsjh_sum_xfs_cjdl; delete from ls_tsjh_sum_xfs_clde; delete from ls_tssb_sum_xfs; delete from ls_tssb_sum_xfs_cjdl; delete from ls_tssb_sum_xfs_clde; delete from ls_tssb_maxid1; delete from ls_tssb_sum2; delete from ls_tssb_maxid2; delete from ls_tssb_sum3; DELETE from ls_tssb_double; DELETE from ls_tssb_double_sum; delete from ls_tsjh_double1; delete from ls_tsjh_double21; delete from ls_tsjh_double11; delete from ls_tsjh_double2; delete from ls_tssb_maxid3; delete from ls_tssb_sum4; --建立临时表 insert into ls_tssb select * from wm_tssb where cpcode = cpcode; insert into ls_tsjh select * from wm_tsjh where cpcode = cpcode; --建立临时汇总数据表 insert into ls_tsjh_sum_all(ldlp_no,cmcode,sz,dpcode,qnt,amt,sl,zsl,se,tsl,ts_amt,ts_pri,amt_pri) SELECT ldlp_no ,cmcode,sz,dpcode,SUM(qnt) AS qnt,SUM(amt) AS amt,SUM(Sl) AS sl,SUM(zsl) AS zsl,SUM(se) AS se,SUM(tsl) AS tsl,SUM(ts_amt) AS ts_amt, SUM(ts_amt) AS ts_pri,SUM(ts_amt) AS amt_pri FROM ls_tsjh GROUP BY LDLP_NO,CMCODE,SZ,dpcode; insert into ls_tssb_sum_all(LDLP_NO ,CMCODE,dpcode,qnt,zzs_ts_amt,xfs_ts_amt) SELECT LDLP_NO ,CMCODE,dpcode,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt,SUM(xfs_ts_amt) AS xfs_ts_amt FROM ls_tssb GROUP BY LDLP_NO ,CMCODE ,dpcode; --更新单价 UPDATE ls_tsjh_sum_all SET ts_pri = (case when qnt<>0 then amt/qnt else 0 end), amt_pri= (case when qnt<>0 then ts_amt/qnt else 0 end); --增值税汇总临时表 delete from ls_tsjh_sum_zzs; insert into ls_tsjh_sum_zzs select * from ls_tsjh_sum_all where sz='V' ; --更新出口表 --更新出口表 UPDATE ls_tssb SET (ts_qnt, tsl, ts_pri) = (select (case when ls_tssb.qnt>ls_tsjh_sum_zzs.qnt then ls_tsjh_sum_zzs.qnt else ls_tssb.qnt end ), (case when ls_tsjh_sum_zzs.qnt<>0 then ls_tsjh_sum_zzs.ts_amt/ls_tsjh_sum_zzs.amt*100 else 0 end), ls_tsjh_sum_zzs.ts_pri from ls_tsjh_sum_zzs where ls_tssb.ldlp_no = ls_tsjh_sum_zzs.ldlp_no and ls_tssb.cmcode = ls_tsjh_sum_zzs.cmcode) where exists (select 1 from ls_tsjh_sum_zzs where ls_tssb.ldlp_no = ls_tsjh_sum_zzs.ldlp_no and ls_tssb.cmcode = ls_tsjh_sum_zzs.cmcode); update ls_tssb set (ckjh_amt,zzs_ts_amt) = (select (case when ls_tsjh_sum_zzs.qnt<>0 then ls_tssb.ts_qnt*ls_tsjh_sum_zzs.amt/ls_tsjh_sum_zzs.qnt else 0 end), (case when ls_tsjh_sum_zzs.qnt<>0 and ls_tsjh_sum_zzs.amt<>0 then ls_tssb.ts_qnt*ls_tsjh_sum_zzs.ts_amt/ls_tsjh_sum_zzs.qnt else 0 end) from ls_tsjh_sum_zzs where ls_tssb.ldlp_no = ls_tsjh_sum_zzs.ldlp_no and ls_tssb.cmcode = ls_tsjh_sum_zzs.cmcode) where exists (select 1 from ls_tsjh_sum_zzs where ls_tssb.ldlp_no = ls_tsjh_sum_zzs.ldlp_no and ls_tssb.cmcode = ls_tsjh_sum_zzs.cmcode ); update ls_tssb set ts_qnt=0,flag='E',ckjh_amt=0,ts_pri=0,zzs_ts_amt=0,tsl=0 where EXISTS (select 1 from ls_tsjh_sum_zzs where ls_tssb.LDLP_NO = ls_tsjh_sum_zzs.LDLP_NO and ls_tssb.CMCODE = ls_tsjh_sum_zzs.CMCODE and ls_tsjh_sum_zzs.qnt-ls_tssb.qnt<0); --检查进货出口数量 delete from err_msg; insert into err_msg select ls_tsjh_sum_zzs.LDLP_NO,ls_tsjh_sum_zzs.dpcode,ls_tsjh_sum_zzs.CMCODE, ls_tsjh_sum_zzs.qnt,LS_TSSB_SUM_ALL.qnt,'E','1' from ls_tsjh_sum_zzs inner join LS_TSSB_SUM_ALL on ls_tsjh_sum_zzs.ldlp_no = LS_TSSB_SUM_ALL.ldlp_no and ls_tsjh_sum_zzs.cmcode = LS_TSSB_SUM_ALL.cmcode where LS_TSSB_SUM_ALL.qnt<>ls_tsjh_sum_zzs.qnt; select count(*) into rowcount from ls_tsjh_sum_zzs inner join LS_TSSB_SUM_ALL on ls_tsjh_sum_zzs.ldlp_no = LS_TSSB_SUM_ALL.ldlp_no and ls_tsjh_sum_zzs.cmcode = LS_TSSB_SUM_ALL.cmcode where LS_TSSB_SUM_ALL.qnt<>ls_tsjh_sum_zzs.qnt; if rowcount =0 THEN insert into ls_tssb_maxid(id,ldlp_no,cmcode,zzs_ts_amt,amt1) select max(id) as id,ldlp_no,cmcode,0 as zzs_ts_amt,0 as amt1 from ls_tssb group by LDLP_NO ,CMCODE; insert into ls_tssb_sum1(LDLP_NO,CMCODE,qnt,zzs_ts_amt) select LDLP_NO,CMCODE,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt from ls_tssb where not exists(select * from ls_tssb_maxid where ls_tssb.id=ls_tssb_maxid.id) group by LDLP_NO ,CMCODE ; update ls_tssb_maxid set zzs_ts_amt=(select ls_tssb_sum1.zzs_ts_amt from ls_tssb_sum1 where ls_tssb_maxid.ldlp_no=ls_tssb_sum1.ldlp_no and ls_tssb_maxid.cmcode=ls_tssb_sum1.cmcode) where EXISTS (select 1 from ls_tssb_sum1 where ls_tssb_maxid.ldlp_no=ls_tssb_sum1.ldlp_no and ls_tssb_maxid.cmcode=ls_tssb_sum1.cmcode); update ls_tssb_maxid set amt1 = (select ls_tsjh_sum_zzs.ts_amt from ls_tsjh_sum_zzs where ls_tssb_maxid.ldlp_no=ls_tsjh_sum_zzs.ldlp_no and ls_tssb_maxid.cmcode=ls_tsjh_sum_zzs.cmcode) where exists (select 1 from ls_tsjh_sum_zzs where ls_tssb_maxid.ldlp_no=ls_tsjh_sum_zzs.ldlp_no and ls_tssb_maxid.cmcode=ls_tsjh_sum_zzs.cmcode); update ls_tssb_maxid set zzs_ts_amt = amt1- zzs_ts_amt where amt1<>0 ; update ls_tssb set zzs_ts_amt =(select ls_tssb_maxid.zzs_ts_amt from ls_tssb_maxid where ls_tssb_maxid.id=ls_tssb.id) where EXISTS (select ls_tssb_maxid.zzs_ts_amt from ls_tssb_maxid where ls_tssb_maxid.id=ls_tssb.id) ; --rop table ls_tssb_maxid; --drop table ls_tssb_sum1; end if; insert into err_msg select LS_TSSB_SUM_ALL.LDLP_NO,LS_TSSB_SUM_ALL.dpcode,LS_TSSB_SUM_ALL.CMCODE, 0,LS_TSSB_SUM_ALL.qnt,'W','1' from LS_TSSB_SUM_ALL where not exists(select * from ls_tsjh_sum_zzs where ls_tsjh_sum_zzs.ldlp_no = LS_TSSB_SUM_ALL.ldlp_no and ls_tsjh_sum_zzs.cmcode = LS_TSSB_SUM_ALL.cmcode); --检查只有进货没有出口 insert into err_msg select LS_TSJH_SUM_ALL.LDLP_NO,ls_tsjh_sum_ALL.dpcode,ls_tsjh_sum_ALL.CMCODE, ls_tsjh_sum_ALL.qnt,0,'E','1' from ls_tsjh_sum_ALL where not exists(select * from ls_tssb_sum_ALL where ls_tsjh_sum_ALL.ldlp_no = LS_TSSB_SUM_ALL.ldlp_no and LS_TSJH_SUM_ALL.cmcode = LS_TSSB_SUM_ALL.cmcode); --检查消费税 --建立最小出口日期出口表 insert into ls_tssb_mindate(ldlp_no,cmcode,m_lj_date) select ldlp_no,cmcode,min(lj_date) as m_lj_date from ls_tssb group by LDLP_NO ,CMCODE ; --建立最小出口日期进货表 insert into ls_tsjh_mindate select ls_tsjh.ldlp_no,ls_tsjh.sz,ls_tsjh.dpcode,ls_tsjh.sb_ym,ls_tsjh.sb_pc, ls_tsjh.sb_no,ls_tsjh.fp_no,ls_tsjh.fp_dm, ls_tsjh.zyfp_no,ls_tsjh.fp_flag,ls_tsjh.ghfns_no,ls_tsjh.kpdate,ls_tsjh.cmcode,ls_tsjh.cmname,ls_tsjh.cmunit,ls_tsjh.qnt,ls_tsjh.amt,ls_tsjh.sl,ls_tsjh.zsl,ls_tsjh.se,ls_tsjh.tsl,ls_tsjh.ts_amt,ls_tsjh.zysp_no,ls_tsjh.note,ls_tsjh.sb_rsv,ls_tsjh.flag,ls_tsjh.sb_flag,ls_tsjh.tz_flag,ls_tsjh.sh_flag,ls_tsjh.sh_time,ls_tsjh.op_user,ls_tsjh.op_date, ls_tssb_mindate.m_lj_date as lj_date from ls_tsjh left join ls_tssb_mindate on ls_tsjh.ldlp_no = ls_tssb_mindate.ldlp_no and ls_tsjh.cmcode = ls_tssb_mindate.cmcode; --消费税进货汇总 insert into ls_tsjh_sum_xfs select ldlp_no ,cmcode,ls_tsjh_mindate.sz,dpcode,SUM(qnt) AS qnt,SUM(amt) AS amt,SUM(Sl) AS sl,SUM(zsl) AS zsl,SUM(se) AS se,SUM(ls_tsjh_mindate.tsl) AS tsl,SUM(ts_amt) AS ts_amt, SUM(ts_amt) AS ts_pri,SUM(ts_amt) AS amt_pri from ls_tsjh_mindate left join allcmcode cmcode on ls_tsjh_mindate.cmcode = cmcode.code and cmcode.st_date<= ls_tsjh_mindate.lj_date and cmcode.end_date> ls_tsjh_mindate.lj_date where ls_tsjh_mindate.sz='C' and ((cmcode.cjdl <> 0 and cmcode.clde = 0) or (cmcode.cjdl = 0 and cmcode.clde <> 0)) GROUP BY LDLP_NO,CMCODE,ls_tsjh_mindate.SZ,dpcode; insert into ls_tsjh_sum_xfs_cjdl select ldlp_no ,cmcode,ls_tsjh_mindate.sz,dpcode,SUM(qnt) AS qnt,SUM(amt) AS amt,SUM(Sl) AS sl,SUM(zsl) AS zsl,SUM(se) AS se,SUM(ls_tsjh_mindate.tsl) AS tsl,SUM(ts_amt) AS ts_amt, SUM(ts_amt) AS ts_pri,SUM(ts_amt) AS amt_pri from ls_tsjh_mindate left join allcmcode cmcode on ls_tsjh_mindate.cmcode = cmcode.code and cmcode.st_date<= ls_tsjh_mindate.lj_date and cmcode.end_date> ls_tsjh_mindate.lj_date where ls_tsjh_mindate.sz='C' and (cmcode.cjdl <> 0 and cmcode.clde = 0) GROUP BY LDLP_NO,CMCODE,ls_tsjh_mindate.SZ,dpcode; insert into ls_tsjh_sum_xfs_clde select ldlp_no ,cmcode,ls_tsjh_mindate.sz,dpcode,SUM(qnt) AS qnt,SUM(amt) AS amt,SUM(Sl) AS sl,SUM(zsl) AS zsl,SUM(se) AS se,SUM(ls_tsjh_mindate.tsl) AS tsl,SUM(ts_amt) AS ts_amt, SUM(ts_amt) AS ts_pri,SUM(ts_amt) AS amt_pri from ls_tsjh_mindate left join allcmcode cmcode on ls_tsjh_mindate.cmcode = cmcode.code and cmcode.st_date<= ls_tsjh_mindate.lj_date and cmcode.end_date> ls_tsjh_mindate.lj_date where ls_tsjh_mindate.sz='C' and (cmcode.cjdl = 0 and cmcode.clde <> 0) GROUP BY LDLP_NO,CMCODE,ls_tsjh_mindate.SZ,dpcode; --消费税出口汇总 insert into ls_tssb_sum_xfs select LDLP_NO ,CMCODE,dpcode,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt,SUM(xfs_ts_amt) AS xfs_ts_amt from ls_tssb left join allcmcode cmcode on ls_tssb.cmcode = cmcode.code and cmcode.st_date<= ls_tssb.lj_date and cmcode.end_date> ls_tssb.lj_date where (cmcode.cjdl <> 0 and cmcode.clde = 0) or(cmcode.cjdl = 0 and cmcode.clde <> 0) GROUP BY LDLP_NO ,CMCODE ,dpcode; insert into ls_tssb_sum_xfs_cjdl select LDLP_NO ,CMCODE,dpcode,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt,SUM(xfs_ts_amt) AS xfs_ts_amt from ls_tssb left join allcmcode cmcode on ls_tssb.cmcode = cmcode.code and cmcode.st_date<= ls_tssb.lj_date and cmcode.end_date> ls_tssb.lj_date where cmcode.cjdl <> 0 and cmcode.clde = 0 GROUP BY LDLP_NO ,CMCODE ,dpcode; insert into ls_tssb_sum_xfs_clde select LDLP_NO ,CMCODE,dpcode,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt,SUM(xfs_ts_amt) AS xfs_ts_amt from ls_tssb left join allcmcode cmcode on ls_tssb.cmcode = cmcode.code and cmcode.st_date<= ls_tssb.lj_date and cmcode.end_date> ls_tssb.lj_date where cmcode.cjdl = 0 and cmcode.clde <> 0 GROUP BY LDLP_NO ,CMCODE ,dpcode; --更新消费税明细数据 update ls_tssb set xfs_ts_amt =(select (case when ls_tssb.qnt>ls_tsjh_sum_xfs.qnt then ls_tsjh_sum_xfs.qnt else ls_tssb.qnt end)*cmcode.cjdl*(case when ls_tsjh_sum_xfs.qnt<>0 then ls_tsjh_sum_xfs.amt/ls_tsjh_sum_xfs.qnt else 0 end) from ls_tssb inner join ls_tsjh_sum_xfs on ls_tssb.ldlp_no = ls_tsjh_sum_xfs.ldlp_no and ls_tssb.cmcode = ls_tsjh_sum_xfs.cmcode left join allcmcode cmcode on ls_tssb.cmcode = cmcode.code and cmcode.st_date<= ls_tssb.lj_date and cmcode.end_date> ls_tssb.lj_date where cmcode.cjdl<>0 and cmcode.clde=0 ) ; update ls_tssb set xfs_ts_amt =(select (case when ls_tssb.qnt>ls_tsjh_sum_xfs.qnt then ls_tsjh_sum_xfs.qnt else ls_tssb.qnt end)*cmcode.clde from ls_tssb inner join ls_tsjh_sum_xfs on ls_tssb.ldlp_no = ls_tsjh_sum_xfs.ldlp_no and ls_tssb.cmcode = ls_tsjh_sum_xfs.cmcode left join allcmcode cmcode on ls_tssb.cmcode = cmcode.code and cmcode.st_date<= ls_tssb.lj_date and cmcode.end_date> ls_tssb.lj_date where cmcode.clde<>0 and cmcode.cjdl=0); update ls_tssb set flag='E',xfs_ts_amt=0 where EXISTS (select 1 from ls_tsjh_sum_xfs where ls_tssb.LDLP_NO = ls_tsjh_sum_xfs.LDLP_NO and ls_tssb.CMCODE = ls_tsjh_sum_xfs.CMCODE and ls_tsjh_sum_xfs.qnt-ls_tssb.qnt<0); --从价定律出口进货数量不等 insert into err_msg select ls_tsjh_sum_xfs_clde.LDLP_NO,ls_tsjh_sum_xfs_clde.dpcode,ls_tsjh_sum_xfs_clde.CMCODE, ls_tsjh_sum_xfs_clde.qnt,ls_tssb_sum_xfs_clde.qnt,'E','2' from ls_tsjh_sum_xfs_clde inner join ls_tssb_sum_xfs_clde on ls_tsjh_sum_xfs_clde.ldlp_no = ls_tssb_sum_xfs_clde.ldlp_no and ls_tsjh_sum_xfs_clde.cmcode = ls_tssb_sum_xfs_clde.cmcode where ls_tssb_sum_xfs_clde.qnt<>ls_tsjh_sum_xfs_clde.qnt ; --从量定额出口数量不等 insert into err_msg select ls_tsjh_sum_xfs_cjdl.LDLP_NO,ls_tsjh_sum_xfs_cjdl.dpcode,ls_tsjh_sum_xfs_cjdl.CMCODE, ls_tsjh_sum_xfs_cjdl.qnt,ls_tssb_sum_xfs_cjdl.qnt,'E','3' from ls_tsjh_sum_xfs_cjdl inner join ls_tssb_sum_xfs_cjdl on ls_tsjh_sum_xfs_cjdl.ldlp_no = ls_tssb_sum_xfs_cjdl.ldlp_no and ls_tsjh_sum_xfs_cjdl.cmcode = ls_tssb_sum_xfs_cjdl.cmcode where ls_tssb_sum_xfs_cjdl.qnt<>ls_tsjh_sum_xfs_cjdl.qnt; --建立没有最后一条记录的汇总数据表 select count(*) into rowcount from ls_tsjh_sum_xfs_cjdl inner join ls_tssb_sum_xfs_cjdl on ls_tsjh_sum_xfs_cjdl.ldlp_no = ls_tssb_sum_xfs_cjdl.ldlp_no and ls_tsjh_sum_xfs_cjdl.cmcode = ls_tssb_sum_xfs_cjdl.cmcode where ls_tssb_sum_xfs_cjdl.qnt<>ls_tsjh_sum_xfs_cjdl.qnt; if rowcount=0 then insert into ls_tssb_maxid1(id,ldlp_no,cmcode,zzs_ts_amt,xfs_ts_amt,amt1) select max(id) as id,ldlp_no,cmcode,0 as zzs_ts_amt,0 as xfs_ts_amt,0 as amt1 from ls_tssb group by LDLP_NO ,CMCODE; insert into ls_tssb_sum2 select LDLP_NO ,CMCODE,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt,SUM(xfs_ts_amt) AS xfs_ts_amt from ls_tssb where not exists(select * from ls_tssb_maxid1 where ls_tssb.id=ls_tssb_maxid1.id) group by LDLP_NO,CMCODE ; update ls_tssb_maxid1 set xfs_ts_amt= (select ls_tssb_sum2.xfs_ts_amt from ls_tssb_sum2 where ls_tssb_maxid1.ldlp_no=ls_tssb_sum2.ldlp_no and ls_tssb_maxid1.cmcode=ls_tssb_sum2.cmcode); update ls_tssb_maxid1 set amt1 = (select ls_tsjh_sum_xfs_cjdl.ts_amt from ls_tsjh_sum_xfs_cjdl where ls_tssb_maxid1.ldlp_no=ls_tsjh_sum_xfs_cjdl.ldlp_no and ls_tssb_maxid1.cmcode=ls_tsjh_sum_xfs_cjdl.cmcode) where exists (select 1 from ls_tsjh_sum_xfs_cjdl where ls_tssb_maxid1.ldlp_no=ls_tsjh_sum_xfs_cjdl.ldlp_no and ls_tssb_maxid1.cmcode=ls_tsjh_sum_xfs_cjdl.cmcode); update ls_tssb_maxid1 set xfs_ts_amt = (select amt1- xfs_ts_amt from ls_tssb_maxid1 where amt1<>0 ); update ls_tssb set xfs_ts_amt = (select ls_tssb_maxid1.xfs_ts_amt from ls_tssb_maxid1 where ls_tssb_maxid1.id=ls_tssb.id) where exists (select 1 from ls_tssb_maxid1 where ls_tssb_maxid1.id=ls_tssb.id ); end if; select count(*) into rowcount from ls_tsjh_sum_xfs_clde inner join ls_tssb_sum_xfs_clde on ls_tsjh_sum_xfs_clde.ldlp_no = ls_tssb_sum_xfs_clde.ldlp_no and ls_tsjh_sum_xfs_clde.cmcode = ls_tssb_sum_xfs_clde.cmcode where ls_tssb_sum_xfs_clde.qnt<>ls_tsjh_sum_xfs_clde.qnt; if rowcount=0 then insert into ls_tssb_maxid2(id,ldlp_no,cmcode,zzs_ts_amt,xfs_ts_amt,amt1) select max(id) as id,ldlp_no,cmcode,0 as zzs_ts_amt,0 as xfs_ts_amt,0 as amt1 from ls_tssb group by LDLP_NO ,CMCODE; insert into ls_tssb_sum3 select LDLP_NO ,CMCODE,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt,SUM(xfs_ts_amt) AS xfs_ts_amt from ls_tssb where not exists(select * from ls_tssb_maxid2 where ls_tssb.id=ls_tssb_maxid2.id) group by LDLP_NO ,CMCODE ; update ls_tssb_maxid2 set xfs_ts_amt = (select ls_tssb_sum3.xfs_ts_amt from ls_tssb_sum3 where ls_tssb_maxid2.ldlp_no=ls_tssb_sum3.ldlp_no and ls_tssb_maxid2.cmcode=ls_tssb_sum3.cmcode) where exists (select 1 from ls_tssb_sum3 where ls_tssb_maxid2.ldlp_no=ls_tssb_sum3.ldlp_no and ls_tssb_maxid2.cmcode=ls_tssb_sum3.cmcode); update ls_tssb_maxid2 set amt1 = (select ls_tsjh_sum_xfs_clde.ts_amt from ls_tsjh_sum_xfs_clde where ls_tssb_maxid2.ldlp_no=ls_tsjh_sum_xfs_clde.ldlp_no and ls_tssb_maxid2.cmcode=ls_tsjh_sum_xfs_clde.cmcode) where EXISTS (select 1 from ls_tsjh_sum_xfs_clde where ls_tssb_maxid2.ldlp_no=ls_tsjh_sum_xfs_clde.ldlp_no and ls_tssb_maxid2.cmcode=ls_tsjh_sum_xfs_clde.cmcode) ; update ls_tssb_maxid2 set xfs_ts_amt =(select amt1- xfs_ts_amt from ls_tssb_maxid2 where amt1<>0 ); update ls_tssb set xfs_ts_amt =(select ls_tssb_maxid2.xfs_ts_amt from ls_tssb_maxid2 where ls_tssb_maxid2.id=ls_tssb.id) where exists (select 1 from ls_tssb_maxid2 where ls_tssb_maxid2.id=ls_tssb.id); end if; --消费税从价定律 insert into err_msg select ls_tssb_sum_xfs_cjdl.LDLP_NO,ls_tssb_sum_xfs_cjdl.dpcode,ls_tssb_sum_xfs_cjdl.CMCODE, 0,ls_tssb_sum_xfs_cjdl.qnt,'W','2' from ls_tssb_sum_xfs_cjdl where not exists(select * from ls_tsjh_sum_xfs where ls_tssb_sum_xfs_cjdl.ldlp_no=ls_tsjh_sum_xfs.ldlp_no and ls_tssb_sum_xfs_cjdl.cmcode=ls_tsjh_sum_xfs.cmcode); insert into err_msg select ls_tsjh_sum_xfs.LDLP_NO,ls_tsjh_sum_xfs.dpcode,ls_tsjh_sum_xfs.CMCODE, ls_tsjh_sum_xfs.qnt,0,'E','2' from ls_tsjh_sum_xfs where not exists(select * from ls_tssb_sum_xfs_cjdl where ls_tssb_sum_xfs_cjdl.ldlp_no=ls_tsjh_sum_xfs.ldlp_no and ls_tssb_sum_xfs_cjdl.cmcode=ls_tsjh_sum_xfs.cmcode); --消费税从量定额 insert into err_msg select ls_tssb_sum_xfs_clde.LDLP_NO,ls_tssb_sum_xfs_clde.dpcode,ls_tssb_sum_xfs_clde.CMCODE, 0,ls_tssb_sum_xfs_clde.qnt,'W','3' from ls_tssb_sum_xfs_clde where not exists(select * from ls_tsjh_sum_xfs where ls_tssb_sum_xfs_clde.ldlp_no=ls_tsjh_sum_xfs.ldlp_no and ls_tssb_sum_xfs_clde.cmcode=ls_tsjh_sum_xfs.cmcode); insert into err_msg select ls_tsjh_sum_xfs.LDLP_NO,ls_tsjh_sum_xfs.dpcode,ls_tsjh_sum_xfs.CMCODE, ls_tsjh_sum_xfs.qnt,0,'E','3' from ls_tsjh_sum_xfs where not exists(select * from ls_tssb_sum_xfs_clde where ls_tssb_sum_xfs_clde.ldlp_no=ls_tsjh_sum_xfs.ldlp_no and ls_tssb_sum_xfs_clde.cmcode=ls_tsjh_sum_xfs.cmcode) ; --消费税双从征税 insert into ls_tssb_double select ls_tssb.* from ls_tssb left join allcmcode cmcode on ls_tssb.cmcode = cmcode.code and cmcode.st_date<= ls_tssb.lj_date and cmcode.end_date> ls_tssb.lj_date where cmcode.cjdl <> 0 and cmcode.clde <> 0; insert into ls_tssb_double_sum SELECT LDLP_NO ,CMCODE,dpcode,SUM(qnt) AS qnt,SUM(zzs_ts_amt) AS zzs_ts_amt,SUM(xfs_ts_amt) AS xfs_ts_amt FROM ls_tssb_double GROUP BY LDLP_NO ,CMCODE ,dpcode; insert into ls_tsjh_double1 select ls_tsjh_mindate.* from ls_tsjh_mindate left join cmcode on cmcode.st_date<= ls_tsjh_mindate.lj_date and cmcode.end_date> ls_tsjh_mindate.lj_date where ls_tsjh_mindate.sz='C' and cmcode.cjdl <> 0 and cmcode.clde <> 0 and sl = cmcode.clde; insert into ls_tsjh_double2 select ls_tsjh_mindate.* from ls_tsjh_mindate left join cmcode on cmcode.st_date<= ls_tsjh_mindate.lj_date and cmcode.end_date> ls_tsjh_mindate.lj_date where ls_tsjh_mindate.sz='C' and cmcode.cjdl <> 0 and cmcode.clde <> 0 and sl <> cmcode.clde; insert into ls_tsjh_double11 select ldlp_no ,cmcode,sz,dpcode,SUM(qnt) AS qnt,SUM(amt) AS amt,SUM(Sl) AS sl,SUM(zsl) AS zsl,SUM(se) AS se,SUM(tsl) AS tsl,SUM(ts_amt) AS ts_amt, SUM(ts_amt) AS ts_pri,SUM(ts_amt) AS amt_pri from ls_tsjh_double1 group by ldlp_no ,cmcode,sz,dpcode; insert into ls_tsjh_double21 select ldlp_no ,cmcode,sz,dpcode,SUM(qnt) AS qnt,SUM(amt) AS amt,SUM(Sl) AS sl,SUM(zsl) AS zsl,SUM(se) AS se,SUM(tsl) AS tsl,SUM(ts_amt) AS ts_amt, SUM(ts_amt) AS ts_pri,SUM(ts_amt) AS amt_pri from ls_tsjh_double2 group by ldlp_no ,cmcode,sz,dpcode; update ls_tssb set xfs_ts_amt = (select (case when ls_tssb.qnt>ls_tsjh_double11.qnt then ls_tsjh_double11.qnt else ls_tssb.qnt end)*allcmcode.clde from ls_tsjh_double11, allcmcode where ls_tssb.ldlp_no = ls_tsjh_double11.ldlp_no and ls_tssb.cmcode = ls_tsjh_double11.cmcode and ls_tssb.cmcode = allcmcode.code(+) and allcmcode.st_date<= ls_tssb.lj_date and allcmcode.end_date> ls_tssb.lj_date) where exists (select 1 from ls_tsjh_double11 where ls_tssb.ldlp_no = ls_tsjh_double11.ldlp_no and ls_tssb.cmcode = ls_tsjh_double11.cmcode); update ls_tssb set flag='E',xfs_ts_amt=0 where exists (select 1 from ls_tsjh_double11 where ls_tssb.LDLP_NO = ls_tsjh_double11.LDLP_NO and ls_tssb.CMCODE = ls_tsjh_double11.CMCODE and ls_tsjh_double11.qnt-ls_tssb.qnt<0); insert into err_msg select ls_tsjh_double11.LDLP_NO,ls_tsjh_double11.dpcode,ls_tsjh_double11.CMCODE, ls_tsjh_double11.qnt,ls_tssb_double_sum.qnt,'E','4' from ls_tsjh_double11 inner join ls_tssb_double_sum on ls_tsjh_double11.ldlp_no = ls_tssb_double_sum.ldlp_no and ls_tsjh_double11.cmcode = ls_tssb_double_sum.cmcode where ls_tssb_double_sum.qnt<>ls_tsjh_double11.qnt; insert into err_msg select ls_tssb_double_sum.LDLP_NO,ls_tssb_double_sum.dpcode,ls_tssb_double_sum.CMCODE, 0,ls_tssb_double_sum.qnt,'W','4' from ls_tssb_double_sum where not exists(select * from ls_tsjh_double11 where ls_tsjh_double11.ldlp_no = ls_tssb_double_sum.ldlp_no and ls_tsjh_double11.cmcode = ls_tssb_double_sum.cmcode ); --进货大于出口 insert into err_msg select ls_tsjh_double11.LDLP_NO,ls_tsjh_double11.dpcode,ls_tsjh_double11.CMCODE, ls_tsjh_double11.qnt,0,'E','4' from ls_tsjh_double11 where not exists(select * from ls_tssb_double_sum where ls_tsjh_double11.ldlp_no = ls_tssb_double_sum.ldlp_no and ls_tsjh_double11.cmcode = ls_tssb_double_sum.cmcode); update ls_tssb set xfs_ts_amt = (select xfs_ts_amt+ (case when ls_tssb.qnt>ls_tsjh_double21.qnt then ls_tsjh_double21.qnt else ls_tssb.qnt end)*allcmcode.cjdl*(case when ls_tsjh_double21.qnt<>0 then ls_tsjh_double21.qnt/ls_tsjh_double21.qnt else 0 end) from ls_tsjh_double21, allcmcode where ls_tssb.ldlp_no = ls_tsjh_double21.ldlp_no and ls_tssb.cmcode = ls_tsjh_double21.cmcode and ls_tssb.cmcode = allcmcode.code(+) and allcmcode.st_date<= ls_tssb.lj_date and allcmcode.end_date> ls_tssb.lj_date) where exists (select 1 from ls_tsjh_double21 where ls_tssb.ldlp_no = ls_tsjh_double21.ldlp_no and ls_tssb.cmcode = ls_tsjh_double21.cmcode); update ls_tssb set flag='E',xfs_ts_amt=0 where exists (select 1 from ls_tsjh_double21 where ls_tssb.LDLP_NO = ls_tsjh_double21.LDLP_NO and ls_tssb.CMCODE = ls_tsjh_double21.CMCODE and ls_tsjh_double21.qnt-ls_tssb.qnt<0); insert into err_msg select ls_tsjh_double21.LDLP_NO,ls_tsjh_double21.dpcode,ls_tsjh_double21.CMCODE, ls_tsjh_double21.qnt,ls_tssb_double_sum.qnt,'E','4' from ls_tsjh_double21 inner join ls_tssb_double_sum on ls_tsjh_double21.ldlp_no = ls_tssb_double_sum.ldlp_no and ls_tsjh_double21.cmcode = ls_tssb_double_sum.cmcode where ls_tssb_double_sum.qnt<>ls_tsjh_double21.qnt; select count(*) into rowcount from ls_tsjh_double21 inner join ls_tssb_double_sum on ls_tsjh_double21.ldlp_no = ls_tssb_double_sum.ldlp_no and ls_tsjh_double21.cmcode = ls_tssb_double_sum.cmcode where ls_tssb_double_sum.qnt<>ls_tsjh_double21.qnt; if rowcount=0 THEN insert into ls_tssb_maxid3 select max(id) as id,ldlp_no,cmcode,0 as zzs_ts_amt,0 as xfs_ts_amt,0 as amt1,0 as amt2 from ls_tssb group by LDLP_NO ,CMCODE; insert into ls_tssb_sum4 select LDLP_NO ,CMCODE,SUM(xfs_ts_amt) AS xfs_ts_amt from ls_tssb where not exists(select * from ls_tssb_maxid3 where ls_tssb.id=ls_tssb_maxid3.id) group by LDLP_NO ,CMCODE; update ls_tssb_maxid3 set xfs_ts_amt = (select ls_tssb_sum4.xfs_ts_amt from ls_tssb_sum4 where ls_tssb_maxid3.ldlp_no=ls_tssb_sum4.ldlp_no and ls_tssb_maxid3.cmcode=ls_tssb_sum4.cmcode) where EXISTS (select 1 from ls_tssb_sum4 where ls_tssb_maxid3.ldlp_no=ls_tssb_sum4.ldlp_no and ls_tssb_maxid3.cmcode=ls_tssb_sum4.cmcode); update ls_tssb_maxid3 set amt1 = (select ls_tsjh_double11.ts_amt from ls_tsjh_double11 where ls_tssb_maxid3.ldlp_no=ls_tsjh_double11.ldlp_no and ls_tssb_maxid3.cmcode=ls_tsjh_double11.cmcode) where exists (select 1 from ls_tsjh_double11 where ls_tssb_maxid3.ldlp_no=ls_tsjh_double11.ldlp_no and ls_tssb_maxid3.cmcode=ls_tsjh_double11.cmcode); update ls_tssb_maxid3 set amt2 = (select ls_tsjh_double21.ts_amt from ls_tsjh_double21 where ls_tssb_maxid3.ldlp_no=ls_tsjh_double21.ldlp_no and ls_tssb_maxid3.cmcode=ls_tsjh_double21.cmcode) where exists (select 1 from ls_tsjh_double11 where ls_tssb_maxid3.ldlp_no=ls_tsjh_double11.ldlp_no and ls_tssb_maxid3.cmcode=ls_tsjh_double11.cmcode); update ls_tssb_maxid3 set xfs_ts_amt = (select amt2+amt1- xfs_ts_amt from ls_tssb_maxid3 where amt1<>0); update ls_tssb set xfs_ts_amt = (select ls_tssb_maxid3.xfs_ts_amt from ls_tssb_maxid3 where ls_tssb_maxid3.id=ls_tssb.id) where exists (select 1 from ls_tssb_maxid3 where ls_tssb_maxid3.id=ls_tssb.id) ; end if; insert into err_msg select ls_tssb_double_sum.LDLP_NO,ls_tssb_double_sum.dpcode,ls_tssb_double_sum.CMCODE, 0,ls_tssb_double_sum.qnt,'W','5' from ls_tssb_double_sum where not exists(select * from ls_tsjh_double21 where ls_tsjh_double21.ldlp_no = ls_tssb_double_sum.ldlp_no and ls_tsjh_double21.cmcode = ls_tssb_double_sum.cmcode ); insert into err_msg select ls_tsjh_double21.LDLP_NO,ls_tsjh_double21.dpcode,ls_tsjh_double21.CMCODE, ls_tsjh_double21.qnt,0,'E','5' from ls_tsjh_double21 where not exists(select * from ls_tssb_double_sum where ls_tsjh_double21.ldlp_no = ls_tssb_double_sum.ldlp_no and ls_tsjh_double21.cmcode = ls_tssb_double_sum.cmcode); --检查结束,更新数据 update ls_tssb set flag='E' where exists (select * from err_msg where ls_tssb.ldlp_no=err_msg.ldlp_no) and flag<>'Z'; update ls_tsjh set flag='E' where exists (select * from err_msg where ls_tsjh.ldlp_no=err_msg.ldlp_no) and flag<>'Z'; --删除正式表的数据,同时将临时表的数据插到正式表中去 DELETE FROM wm_tssb WHERE cpcode = cpcode; --将数据转入正式表 INSERT INTO wm_tssb(cpcode,ldlp_no,dpcode,sb_ym,sb_pc,sb_no,hgdjc_no,inv_no,bgd_no,lj_date,usd_amt,hxd_no, cmcode,cmname,cmunit,qnt,ts_qnt,ts_pri,ckjh_amt,tsl,zzs_ts_amt,xfs_ts_amt,dlzm_no,yqshzm_no, dzbq_flag,xxbq_flag,note,sb_rsv,flag,sb_flag,tz_flag,sh_flag,op_user,op_date,ht_no,item_no,bhtba) SELECT cpcode,ldlp_no,dpcode,sb_ym,sb_pc,sb_no,hgdjc_no,inv_no,bgd_no,lj_date,usd_amt,hxd_no, cmcode,cmname,cmunit,qnt,ts_qnt,ts_pri,ckjh_amt,tsl,zzs_ts_amt,xfs_ts_amt,dlzm_no,yqshzm_no, dzbq_flag,xxbq_flag,note,sb_rsv,flag,sb_flag,tz_flag,sh_flag,op_user,op_date,ht_no,item_no,bhtba FROM ls_tssb; DELETE FROM wm_tsjh WHERE cpcode = cpcode; INSERT INTO wm_tsjh(id,cpcode,ldlp_no,sz,dpcode,sb_ym,sb_pc,sb_no, fp_no,fp_dm,zyfp_no,fp_flag,ghfns_no,kpdate, cmcode,cmname,cmunit,qnt,amt,sl,zsl,se,tsl, ts_amt,zysp_no,note,sb_rsv,flag,sb_flag, tz_flag,sh_flag,sh_time,op_user,op_date) SELECT id,cpcode,ldlp_no,sz,dpcode,sb_ym,sb_pc,sb_no, fp_no,fp_dm,zyfp_no,fp_flag,ghfns_no,kpdate, cmcode,cmname,cmunit,qnt,amt,sl,zsl,se,tsl, ts_amt,zysp_no,note,sb_rsv,flag,sb_flag, tz_flag,sh_flag,sh_time,op_user,op_date FROM ls_tsjh; open out_cursor for select * from err_msg; -- routine body goes here, e.g. DBMS_OUTPUT.PUT_LINE('Navicat for Oracle'); END wm_jhze_chk;
调用 存储过程
public ArrayList getJHCKSLResult(String cpcode){ ArrayList list = new ArrayList(); Connection conn = null; CallableStatement st = null; ResultSet rs = null; JHCKCBJCVO vo = null; //调用过程 String strSQL = "{ call wm_jhze_chk (?,?) }"; try { conn = DBConnection.getConnection(); st = conn.prepareCall(strSQL); st.setString(1, cpcode); st.registerOutParameter(2,OracleTypes.CURSOR); rs = st.executeQuery(); rs = (ResultSet)st.getObject(2); while(rs.next()){ vo = new JHCKCBJCVO(); vo.setLdlp_no(rs.getString(1)); vo.setDpcode(rs.getString(2)); vo.setCmcode(rs.getString(3)); vo.setTsjh_qnt(rs.getDouble(4)); vo.setTssb_qnt(rs.getDouble(5)); //flag 分为W,E两个级别 vo.setFlag(rs.getString(6)); //err_flag含义:1.zzs 2.消费税 cjdl 3.消费税 clde 4.消费税 sczs vo.setErr_type(rs.getString(7)); list.add(vo); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ try { st.close(); conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return list; }
您还没有登录,请您登录后再发表评论
- `exesyscommand.jsp`: 这看起来是一个Java Servlet,可能是用于通过Web接口与数据库交互,调用存储过程执行批处理脚本。 - `PR_OTHER_SYSTEM_DATA_IMPORT.prc`: 这可能是一个存储过程,用于导入其他系统数据,它...
本文实例讲述了Python使用cx_Oracle调用Oracle存储过程的方法。分享给大家供大家参考,具体如下: 这里主要测试在Python中通过cx_Oracle调用PL/SQL。 首先,在数据库端创建简单的存储过程。 create or replace ...
能不能写个动态的业务,只输入存储过程名称,自动获取存储过程参数,并且参数的数据从前台传递过来...只根据输入不同的存储过程名称、参数内容,自动调用不同的存储过程。 已经使用在多个项目中 全开源项目 请放心下载
在Hibernate中,调用存储过程通常通过Session对象的createNativeQuery()方法实现,这个方法用于创建原生SQL查询,可以方便地调用数据库的自定义SQL或者存储过程。以下是一个简单的示例,展示了如何调用一个不带参数...
ibatis调用oracle存储过程分页
用 Java 调用 Oracle 存储过程时,需要使用 JDBC 驱动程序来连接 Oracle 数据库,然后使用 CallableStatement 对象来调用存储过程。 在存储过程中做简单动态查询 在存储过程中,做简单动态查询需要使用 EXECUTE ...
在与帆软报表集成时,正确理解和调用存储过程能极大地增强报表功能和性能。 总结起来,"帆软报表Oracle存储过程解决storeParameter1参数试用插件"主要是针对在调用无参数Oracle存储过程时出现的异常问题提供的一种...
vba 调用oracle 存储过程vba 调用oracle 存储过程vba 调用oracle 存储过程vba 调用oracle 存储过程vba 调用oracle 存储过程
### C#调用Oracle方法(包括调用存储过程) 在.NET框架中,使用C#语言进行数据库操作是一项常见的任务。本文将详细介绍如何使用C#语言连接Oracle数据库,并演示如何调用Oracle存储过程,特别是带有输出参数的情况。...
CallabledStatement interface 是 Statement 的一个子接口,提供了一些特殊的方法来调用存储过程。使用 CallabledStatement 可以提高应用程序的性能和安全性。 三、IN OUT 参数的使用 IN OUT 参数是一种特殊的参数...
- 如果连接成功,则通过`ADOStoredProc1`组件调用存储过程`pkg_test.get`。 - 创建输入参数`p1`,并为其赋值1。 - 最后,执行存储过程。 通过以上步骤,我们可以在Delphi中成功调用Oracle的存储过程,并获取其...
使用Spring的JdbcTemplate调用Oracle的存储过程
5. **报表取值与正常报表设置一样**:报表的其他设置(如表格、图表等)与普通报表无异,主要的区别在于数据来源是调用存储过程。 6. **Tomcat中的数据源设置**:在Tomcat服务器的配置文件(通常为`context.xml`)...
本文将深入探讨如何在Spring Boot项目中整合MyBatis,实现调用Oracle存储过程并处理游标返回的数据。 首先,我们需要在Spring Boot项目中引入相关的依赖。在`pom.xml`文件中添加Oracle JDBC驱动(ojdbc66-oracle...
在C#中调用Oracle存储过程来返回数据集是一个常见的任务,这涉及到ADO.NET库的使用,特别是OracleClient组件。Oracle存储过程是数据库中的预编译SQL代码块,可以接收输入参数,执行复杂的业务逻辑,并返回结果。在C#...
存储过程是预编译的SQL和PL/SQL语句集合,它们存储在数据库中并可以被调用执行。通过存储过程,我们可以封装复杂的业务逻辑,提高代码复用性和执行效率。 在Oracle中,访问接口通常需要使用UTL_HTTP或者DBMS_HTTP包...
对于 `P_EMP_SELECT` 存储过程,我们使用 `CallableStatementCallback` 对象调用存储过程,并将结果集处理到 `List` 集合中。 对于 `P_EMP_ADD` 存储过程,我们使用 `CallableStatementCallback` 对象调用存储过程...
调用Oracle函数的过程与调用存储过程类似,但创建CallableStatement时的SQL语句略有不同。由于函数会返回一个值,所以格式通常是`{? = call function_name(?, ?, ...)}`。在执行后,通过`CallableStatement....
相关推荐
- `exesyscommand.jsp`: 这看起来是一个Java Servlet,可能是用于通过Web接口与数据库交互,调用存储过程执行批处理脚本。 - `PR_OTHER_SYSTEM_DATA_IMPORT.prc`: 这可能是一个存储过程,用于导入其他系统数据,它...
本文实例讲述了Python使用cx_Oracle调用Oracle存储过程的方法。分享给大家供大家参考,具体如下: 这里主要测试在Python中通过cx_Oracle调用PL/SQL。 首先,在数据库端创建简单的存储过程。 create or replace ...
能不能写个动态的业务,只输入存储过程名称,自动获取存储过程参数,并且参数的数据从前台传递过来...只根据输入不同的存储过程名称、参数内容,自动调用不同的存储过程。 已经使用在多个项目中 全开源项目 请放心下载
在Hibernate中,调用存储过程通常通过Session对象的createNativeQuery()方法实现,这个方法用于创建原生SQL查询,可以方便地调用数据库的自定义SQL或者存储过程。以下是一个简单的示例,展示了如何调用一个不带参数...
ibatis调用oracle存储过程分页
用 Java 调用 Oracle 存储过程时,需要使用 JDBC 驱动程序来连接 Oracle 数据库,然后使用 CallableStatement 对象来调用存储过程。 在存储过程中做简单动态查询 在存储过程中,做简单动态查询需要使用 EXECUTE ...
在与帆软报表集成时,正确理解和调用存储过程能极大地增强报表功能和性能。 总结起来,"帆软报表Oracle存储过程解决storeParameter1参数试用插件"主要是针对在调用无参数Oracle存储过程时出现的异常问题提供的一种...
vba 调用oracle 存储过程vba 调用oracle 存储过程vba 调用oracle 存储过程vba 调用oracle 存储过程vba 调用oracle 存储过程
### C#调用Oracle方法(包括调用存储过程) 在.NET框架中,使用C#语言进行数据库操作是一项常见的任务。本文将详细介绍如何使用C#语言连接Oracle数据库,并演示如何调用Oracle存储过程,特别是带有输出参数的情况。...
CallabledStatement interface 是 Statement 的一个子接口,提供了一些特殊的方法来调用存储过程。使用 CallabledStatement 可以提高应用程序的性能和安全性。 三、IN OUT 参数的使用 IN OUT 参数是一种特殊的参数...
- 如果连接成功,则通过`ADOStoredProc1`组件调用存储过程`pkg_test.get`。 - 创建输入参数`p1`,并为其赋值1。 - 最后,执行存储过程。 通过以上步骤,我们可以在Delphi中成功调用Oracle的存储过程,并获取其...
使用Spring的JdbcTemplate调用Oracle的存储过程
5. **报表取值与正常报表设置一样**:报表的其他设置(如表格、图表等)与普通报表无异,主要的区别在于数据来源是调用存储过程。 6. **Tomcat中的数据源设置**:在Tomcat服务器的配置文件(通常为`context.xml`)...
本文将深入探讨如何在Spring Boot项目中整合MyBatis,实现调用Oracle存储过程并处理游标返回的数据。 首先,我们需要在Spring Boot项目中引入相关的依赖。在`pom.xml`文件中添加Oracle JDBC驱动(ojdbc66-oracle...
在C#中调用Oracle存储过程来返回数据集是一个常见的任务,这涉及到ADO.NET库的使用,特别是OracleClient组件。Oracle存储过程是数据库中的预编译SQL代码块,可以接收输入参数,执行复杂的业务逻辑,并返回结果。在C#...
存储过程是预编译的SQL和PL/SQL语句集合,它们存储在数据库中并可以被调用执行。通过存储过程,我们可以封装复杂的业务逻辑,提高代码复用性和执行效率。 在Oracle中,访问接口通常需要使用UTL_HTTP或者DBMS_HTTP包...
对于 `P_EMP_SELECT` 存储过程,我们使用 `CallableStatementCallback` 对象调用存储过程,并将结果集处理到 `List` 集合中。 对于 `P_EMP_ADD` 存储过程,我们使用 `CallableStatementCallback` 对象调用存储过程...
调用Oracle函数的过程与调用存储过程类似,但创建CallableStatement时的SQL语句略有不同。由于函数会返回一个值,所以格式通常是`{? = call function_name(?, ?, ...)}`。在执行后,通过`CallableStatement....