<p>The stored routine declares or references a variable whose name shadows an existing identifier, so MySQL demands backtick quoting or a unique name.</p>
<p>MySQL Error 1453: ER_SP_BAD_VAR_SHADOW occurs when a stored procedure variable name collides with another identifier. Quote the variable with backticks or choose a different name to resolve the conflict.</p>
Variable '%s' must be quoted with `...`, or renamed
The server raises this error when a variable declared inside a stored procedure or function uses the same name as a table column, parameter, or previously declared variable.
MySQL protects developers from accidental shadowing that can change query results silently. The error forces you to clarify intent by quoting the variable or renaming it.
The message shows at routine creation or during ALTER PROCEDURE statements. It can also appear at runtime if dynamic SQL defines conflicting aliases.
Versions 5.7 and later enforce this rule strictly when the sql_mode includes STRICT or when stored program validation is enabled.
Leaving name collisions unresolved leads to unpredictable logic, hard-to-trace bugs, and maintenance headaches. Addressing the error early keeps routines readable and safe.
Declaring a local variable with the same name as an IN or OUT parameter triggers the error.
Two local variables declared with identical names inside the same BEGIN ... END block cause a collision.
Using a column name as a variable without backticks misleads the parser, especially in SELECT ... INTO statements.
Raised when a SELECT ... INTO fails to return data rather than variable shadowing.
Name collision at the table level instead of within a stored routine.
Occurs when creating a routine that already exists under the same schema.
You can remove STRICT sql_mode, but doing so risks subtle bugs. Renaming variables is recommended.
No. They only guide the parser; execution speed remains unchanged.
Yes. The same name collision rules apply inside trigger bodies.
Galaxy's editor highlights variable collisions in real time and suggests unique names through its AI copilot, reducing chance of shadowing.