Java调用存储过程
public static void main(String[] args ){
String driver = "oracle.jdbc.driver.OracleDriver";
String strUrl = "jdbc:oracle:thin:@127.0.0.1:1521:hyq";
Statement stmt = null;
ResultSet rs = null;
Connection conn = null;
try {
Class.forName(driver);
conn = DriverManager.getConnection(strUrl,
"hyq", "hyq");
CallableStatement proc = null;
proc = conn.prepareCall("{ call hyq.testc(?)
}");
proc.registerOutParameter(1,oracle.jdbc.OracleTypes.CURSOR);
proc.execute();
rs = (ResultSet)proc.getObject(1);
while(rs.next())
//调用存储过程 删除流程相关记录
String procdure = "{Call sp_deleteInstByRootID(?)}";
CallableStatement cs = this.getHibernateTemplate().getSessionFactory().getCurrentSession().connection().prepareCall(procdure);
//this.getSession().connection().prepareCall(procdure).setString(0, orgdefid);
cs.setString(1, procinstid);
cs.execute();
ibatis配置文件:
复制代码
id="parameterMapCesu" class="java.util.Map">
jdbcType="VARCHAR2"