MySQL: @variable vs. variable. What's the difference?

前端 未结 4 1181
梦毁少年i
梦毁少年i 2020-11-22 01:28

In another question I posted someone told me that there is a difference between:

@variable

and:

variable

4条回答
  •  余生分开走
    2020-11-22 02:13

    In principle, I use UserDefinedVariables (prepended with @) within Stored Procedures. This makes life easier, especially when I need these variables in two or more Stored Procedures. Just when I need a variable only within ONE Stored Procedure, than I use a System Variable (without prepended @).

    @Xybo: I don't understand why using @variables in StoredProcedures should be risky. Could you please explain "scope" and "boundaries" a little bit easier (for me as a newbe)?

提交回复
热议问题