File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes mysql cursor in stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "mysql cursor in stored procedure" Watch "mysql cursor in stored procedure" New topic

mysql cursor in stored procedure

Shilpa Tendulkar
Ranch Hand

Joined: Jul 29, 2001
Posts: 75
I have created a stored procedure which returns few records depend on IN parameter pass to it. Using those records I want to select some data from another table.
My problem is this stored proceduer doesnt compile and gives syntax error on
line no. 11. Which is -- "DECLARE user_cursor CURSOR ".

complete error is:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE user_cursor CURSOR
FOR SELECT username FROM `user` WHERE distributor_i' at line 11

I am using mysql 5.2.3, Stored procedure is

I am new to stored procedures and cursor. Any help will be highly appreciated.

Thank you.

Consider Paul's rocket mass heater.
subject: mysql cursor in stored procedure
jQuery in Action, 3rd edition