1325
MySQLerrorstored-procedureshigh confidence
Duplicate cursor name
Production Risk
Low — compile-time error; routine not created.
What this means
Two DECLARE CURSOR statements in the same block use the same cursor name.
Why it happens
- 1Copy-paste error when declaring multiple cursors
How to reproduce
trigger — this will error
trigger — this will error
DECLARE cur CURSOR FOR SELECT a FROM t; DECLARE cur CURSOR FOR SELECT b FROM t;
expected output
ERROR 1325 (42000): Duplicate cursor: cur
Fix
Use unique cursor names
Why this works
Each cursor must have a distinct name per block.
Sources
Official documentation ↗
MySQL 8.0 — 1325 ER_SP_DUP_CURS
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev