请问java如何调用oracle 中的存储过程?并获取存储过程的输出结果? 比如,下面这个存储过程PROCEDURE sp_hlr_sync(I_HLR_ID IN NUMBER,O_FLAG OUT NUMBER,O_MSG OUT VARCHAR2)如何在java中分别获得 OUT 的两个值? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try{ int age = 39; String poetName = "dylan thomas"; CallableStatement proc = connection.prepareCall("{ call set_death_age(?, ?) }"); proc.setString(1, poetName); proc.setInt(2, age); cs.execute();}catch (SQLException e){ // ....} http://dev.csdn.net/develop/article/24/24621.shtm public class ProcessPoetDeaths{ public abstract void sendDeath(String name, int age);} static void mapEarlyDeaths(ProcessPoetDeaths mapper){ Connection con = null; CallableStatement toesUp = null; try { con = ConnectionPool.getConnection(); con.setAutoCommit(false); CallableStatement toesUp = connection.prepareCall("{ ? = call list_early_deaths () }"); toesUp.registerOutParameter(1, Types.OTHER); toesUp.execute(); ResultSet rs = (ResultSet) toesUp.getObject(1); while (rs.next()) { String name = rs.getString(1); int age = rs.getInt(2); mapper.sendDeath(name, age); } rs.close(); } catch (SQLException e) { // We should protect these calls. toesUp.close(); con.close(); }} CallableStatement a = conn.prepareCall("{?=存储过程(?)}"); if(a == null)//取凭证序号失败 resInsert = false; else{ a.registerOutParameter(1, ""); // a.registerOutParameter(2, " "); // a.execute(); String str = a.getString(1); //取返回值数据} %ORACLE_HOME%\ora90\jdbc\demo\samples\oci8\basic-samples完美例子。 java实现下载的疑问 构造方法如果是设了有参构造方法,是不是"一定要显式"定义无参构造函数. 在java里怎么从xml里读写数据 BigDecimal问题 子类可以继承父类的static方法 怎样在大图片上用鼠标拖动选取一个小图片? java.lang.NoClassDefFoundError: MyClass 这是什么错误? 一个applet读取数据库,用appleviewer运行成功,详细如下,马上结分,我是一个爽快的人! 软件包 java.unit 不存在是什么回事 单例类不太懂 怎样设置布局使,显示如下效果 为什么用IE打开一个包含简单Applet的html文件时是一片灰色
if(a == null)//取凭证序号失败
resInsert = false;
else{
a.registerOutParameter(1, ""); //
a.registerOutParameter(2, " "); //
a.execute();
String str = a.getString(1); //取返回值数据
}
完美例子。