the_new_mr
the_new_mr

Reputation: 3733

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.

Upvotes: 1

Views: 1238

Answers (1)

Tegiri Nenashi
Tegiri Nenashi

Reputation: 3086

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.

Upvotes: 3

Related Questions