Possible Duplicate:
MySQL: @variable vs. variable. Whats the difference?
I am coming from frontend background so bear with me if this question seems elementary.
I noticed the majority of posts on MySQL stored proc uses @
for variables. I know this means the variable is a session variable that across stored proc will persist as long as the connection is alive but why would you want one variable to cross-contaminate multiple stored proc calls within 1 connection? Isn't it better to localize everything? If I don't use @
, the variable is re-initialized to NULL
on the next stored proc call, isn't that more desirable? Is this done for performance reason?