没有合适的资源?快使用搜索试试~ 我知道了~
实际项目中java调用oracle存储过程和函数
4星 · 超过85%的资源 需积分: 9 16 下载量 6 浏览量
2013-05-16
15:16:56
上传
评论
收藏 2KB TXT 举报
温馨提示
试读
3页
实际项目中java调用oracle存储过程和函数(经典)
资源推荐
资源详情
资源评论
内容或简介:
/**
调用数据库里的一个函数
一个函数本质上一个返回一个结果的存储过程,这个例子示范了怎么调用有in、out和in/out参数的函数
***********************************/
CallableStatement cs;
try {
// 调用一个没有参数的函数; 函数返回 a VARCHAR
// 预处理callable语句
cs = connection.prepareCall("{? = call myfunc}");
// 注册返回值类型
cs.registerOutParameter(1, i);
// Execute and retrieve the returned value
cs.execute();
String retValue = cs.getString(1);
// 调用有一个in参数的函数; the function returns a VARCHAR
cs = connection.prepareCall("{? = call myfuncin(?)}");
// Register the type of the return value
cs.registerOutParameter(1, Types.VARCHAR);
// Set the value for the IN parameter
cs.setString(2, "a string");
// Execute and retrieve the returned value
cs.execute();
/**
调用数据库里的一个函数
一个函数本质上一个返回一个结果的存储过程,这个例子示范了怎么调用有in、out和in/out参数的函数
***********************************/
CallableStatement cs;
try {
// 调用一个没有参数的函数; 函数返回 a VARCHAR
// 预处理callable语句
cs = connection.prepareCall("{? = call myfunc}");
// 注册返回值类型
cs.registerOutParameter(1, i);
// Execute and retrieve the returned value
cs.execute();
String retValue = cs.getString(1);
// 调用有一个in参数的函数; the function returns a VARCHAR
cs = connection.prepareCall("{? = call myfuncin(?)}");
// Register the type of the return value
cs.registerOutParameter(1, Types.VARCHAR);
// Set the value for the IN parameter
cs.setString(2, "a string");
// Execute and retrieve the returned value
cs.execute();
资源评论
- ymj4012014-08-25一般般吧,还行。
Hacker
- 粉丝: 16
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功