Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

mysql cursor in stored procedure

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic