当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
oracle综合:JDBC调用PL/SQL函数(二)
发布时间:2010/11/17 9:49:20 来源:www.xue.net 编辑:城市总裁吧
     // 注册返回值类型

  cs.registerOutParameter(1, i);

  // Execute and retrieve the returned value

  cs.execute();

  int retValue = cs.getInt(1);

  // 调用有一个in参数的函数; the function returns a number

  cs = connection.prepareCall("{? = call get_age(?)}");   // Register the type of the return value

  cs.registerOutParameter(1, Types.number);   // Set the value for the IN parameter

  cs.setInt(2, 95001);   // Execute and retrieve the returned value

  cs.execute();   retValue = cs.getInt(1);

  1. cs = connection.prepareCall("{? = call get_age(?)}");

  2.    // Register the type of the return value

  3.    cs.registerOutParameter(1, Types.number);

  4.    // Set the value for the IN parameter

  5.    cs.setInt(2, 95001);

  6.    // Execute and retrieve the returned value

  7.    cs.execute();

  8.    retValue = cs.getInt(1);

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved