java 中调用oracle 存储过程到execute()就不执行了
java 中调用oracle 存储过程到execute()就不执行了中间也不报错,存储过程在oracle中调用 测试过没有问题。oracle过程如下:
CREATE or replace procedure test_emp(aename VARCHAR2,asal NUMBER) IS
BEGIN
UPDATE emp set sal=asal where ename=aename;
end;
package com.oracle.db;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
public class OraclePro {
public static void main(String[] args) {
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORCL","scott","admin");
CallableStatement st=conn.prepareCall("{call test_emp(?,?)}");
st.setString(1, "SCOTT");
st.setInt(2,123);
System.out.println("执行");
st.execute();
System.out.println("OK");
st.close();
conn.close();
}catch (Exception e){
System.out.println("失败");
e.printStackTrace();
}
}
}