JSP调用存储过程

先看一个简单的例子,这里用的是PL/SQL   oracle 10g.

首先建立一个存储过程,用于删除用户及与用户相关的信息

create or replace procedure proc_person_data_clear(
usercode in varchar,unitcode in varchar,newDate in varchar)
/*usercode   删除人员的账号
  unitcode   删除人员所在的单位代码
  newDate    当前日期
*/
as
begin
   /*删除备忘录内当前人员的所有事项*/
  delete from pending_affairs where useraccount=usercode and systemcode=unitcode;
  /*删除文档管理内创建人为当前人员的且为个人文档*/
  delete from document_manager where doctype='0' and useraccount=usercode and systemcode=unitcode;
  /*删除当前人员的所有签到信息*/
  delete from person_sign_in where usercode=usercode and systemcode=unitcode;
  /*在用户管理内删除该人员账号*/
  delete from pub_person_manager  where useraccount=usercode and unit=unitcode;
end proc_person_data_clear;

 

然后在JSP页面调用该存储过程

 

 //连接数据库
 DbHandlerWithSharePool db = new DbHandlerWithSharePool();/*db是一个数据库连接对象*/
 if(db.open() == false){
   out.print(Tools.showMsg(GetErrDes.exDbCon));
       return; 
 }
 Connection conn=db.getConn();

   db.beginTrans();
   CallableStatement stmt=conn.prepareCall("call proc_person_data_clear(?,?,?)");   //调用存储过程来进行人员数据的清理
   stmt.setString(1,useraccount);
   stmt.setString(2,cua.getSystemCode());
   stmt.setString(3,Tools.getDateString());
   stmt.execute();
    db.commit();
   stmt.close();

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值