I was very disappointed when i was stuck for almost half an hour just to declare a variable inside the stored procedure in MySQL db.
I searched so many blogs stating many solutions to the problem, but no one suggested the basic solution.
Ultimately i managed to find it by myself, so thought i must share it with biginners of MySQL.
The trick is that the DECLARE statement must follow the BEGIN statement i.e. variables must be declared immediately after BEGIN statement of the stored procedure.