Problem solve Get help with specific problems with your technologies, process and projects.

User vs. local variables

A MySQL expert describes the difference between user variables and local variables.

What is the difference between user variables and local variables?

Local variables refer to variables declared within a stored routine. Their scope is limited to the BEGIN and END...

block in which they are declared.

User variables are named with the @ symbol, and have global scope within the connection (you can set them inside a stored procedure, and still access them after the procedure has finished, for example).

This was last published in June 2007

Dig Deeper on Linux servers



Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.