Monday, March 30, 2009

How to declare a variable in MySQL Stored Procedure

Hi Friends,

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.




Thats all..
Cheers

6 comments:

Anonymous said...

That is great, thanks for posting that tip!

Anonymous said...

Amiable dispatch and this mail helped me alot in my college assignement. Thank you for your information.

Naviya Nair said...

Great Article
C# Training
C# Online Training
C-Sharp Training
Dot Net Training in Chennai
.Net Online Training
ASP.NET Training

gkr ragini said...

This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
Best Devops online Training
Online DevOps Certification Course - Gangboard

Unknown said...

Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
Selenium training in Chennai

Selenium training in Bangalore

Selenium training in Pune

Selenium Online training

Mounika said...

Thanks Admin for sharing such a useful post, I hope it’s useful to many individuals for developing their skill to get good career.
python Training in Pune
python Training in Chennai
python Training in Bangalore