Java中如何实现调用Oracle函数并处理返回的记录集?
- 内容介绍
- 文章标签
- 相关推荐
本文共计781个文字,预计阅读时间需要4分钟。
探索相关领域
Oracle函数返回REF CURSOR时,Java必须用CallableStatement注册Types.OTHER
oracle的pl/sql函数若返回sys_refcursor(即记录集),java无法用preparedstatement处理——它只支持单值结果。必须用callablestatement调用,并显式注册out参数类型为types.other,否则会抛sqlexception: invalid column type。
常见错误是把函数当存储过程用executeUpdate(),或漏掉registerOutParameter。
本文共计781个文字,预计阅读时间需要4分钟。
探索相关领域
Oracle函数返回REF CURSOR时,Java必须用CallableStatement注册Types.OTHER
oracle的pl/sql函数若返回sys_refcursor(即记录集),java无法用preparedstatement处理——它只支持单值结果。必须用callablestatement调用,并显式注册out参数类型为types.other,否则会抛sqlexception: invalid column type。
常见错误是把函数当存储过程用executeUpdate(),或漏掉registerOutParameter。

