简体   繁体   中英

Alternative to using a REF CURSOR in JDBC or Spring JDBC?

I've Googled this a bit and searched here and haven't been able to find the answer.

Is there an alternative to using a REF CURSOR when returning data in PL/SQL from a Database to Java (using Spring JDBC)?

The DBAs where I work hate REF CURSORS because (they say) that the potential for something to go wrong is greater and they would prefer if we were returning CURSORs or TYPES.

Does anyone know if this is possible and, if so, how?

Thanks in advance.

Your DBA is absolutely right hating cursors: they can leak, pose security risks, and have awkward noisy syntax. Pipelined (table) function is better abstraction than a cursor.

The pipelined function output is something undistinguished from an ordinary table/view. Java client would use the same JDBC API calls when performing stanfard SQL query. Likewise, for PL/SQL pipelined function remains hidden within an SQL query, therefore warranting no special datatypes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM