调用存储过程

public boolean xx(String xx) {
Connection conn = null;
Statement stmt = null;
CallableStatement   proc   =   null;
List sqlList = new ArrayList();
try {
Session session = HibernateSessionFactory.getSession();
conn = session.connection();
proc = conn.prepareCall("{ call xx(?)}");
proc.setString(1,xx);    
proc.execute();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
proc.close();
HibernateSessionFactory.closeSession();
} catch (Exception e) {
e.printStackTrace();
}
}
return true;
//
}


create or replace procedure xx(value varchar2)
as   
    
begin 
delete from table1 a where a.name=value;
delete from table2 a where a.name=value;
end;

commit;
end; 

你可能感兴趣的:(存储过程)