1323
MariaDBerrorstored-procedureshigh confidence
Duplicate variable name
Production Risk
Low — compile-time error; routine not created.
What this means
Two local variables in the same BEGIN...END block are declared with the same name.
Why it happens
- 1Copy-paste error in DECLARE statements
- 2Merging two blocks without checking for name collisions
How to reproduce
trigger — this will error
trigger — this will error
CREATE PROCEDURE p() BEGIN DECLARE v INT; DECLARE v VARCHAR(10); END;
expected output
ERROR 1323 (42000): Duplicate variable: v
Fix
Use unique variable names in the same block
Why this works
Each DECLARE name must be unique within its block scope.
Sources
Official documentation ↗
MySQL 8.0 — 1323 ER_SP_DUP_VAR
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev