MySQL: @variable vs. variable. Whats the difference?
In another question I posted someone told me that there is a difference between:
and:
in MySQL. He also mentioned how MSSQL has batch scope and MySQL has session scope. Can someone elaborate on this for me? |
|
add a comment
|
They are loosely typed variables that may be initialized somewhere in a session and keep their value until the session ends. They are prepended with an You can initialize this variable with a
When you develop a stored procedure in
These variables are not prepended with any prefixes. The difference between a procedure variable and a session-specific user-defined variable is that procedure variable is reinitialized to
As you can see, (In addition to user-defined variables, MySQL also has some predefined "system variables", which may be "global variables" such as
|