Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does MySQL support Oracle-like ref cursors??

Status
Not open for further replies.

thameema

Programmer
Jan 30, 2001
30
US
Does anybody know if MySQL supports the ability for a stored procedure to return a "ref cursor" (Oracle term)?

Here is an example of an Oracle procedure that returns a ref cursor:

PROCEDURE my_proc
(a_out_cursor OUT ref cursor)
IS
BEGIN
open a_out_cursor for
select col_a, col_b
from my_table;
END;

I am using Java, so I would call this procedure as follows:

CallableStatement statement = null;
Connection connection = getConnection(); //returns a java.sql.Connection

//Use factory to get statement
statement = CallableStatementFactory.getCallableStatement(connection, "call my_proc(?)");

statement.registerOutParameter(1, OracleTypes.CURSOR);

// Execute the procedure
statement.execute();


I would like to perform this same sort of fetching using MySQL instead of Oracle. Does anybody know if it is possible? Or must all CallableStatements be setup as queries and not stored procedures?

Any help is appreciated.
 
I have searched the mysql forums, manuals and the link you gave and don't find my answer. Please read the question once again .....I need to return the cursor to my application.

Thanks,
Thameem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top