Search code examples
mysqlcursordeclare

How to declare a variable in mysql and how to create a CURSOR


I am creating a CURSOR in mysql (version is 5.0.96-community), but it is alerting me an error with my variable declaration.

Even when I cut it down and is left with only one sentence declared, it still shows error.

enter image description here


Solution

  • Please try like this,

    delimiter $$
    create procedure curdemo()
    begin
    declare a char(16);
    end ;