1758
MySQLERRORNotableStored ProceduresHIGH confidence
Invalid condition number in RESIGNAL/GET DIAGNOSTICS
Production Risk
Low — stored procedure error.
What this means
A RESIGNAL or GET DIAGNOSTICS statement referenced a condition area number that is out of range or does not exist.
Why it happens
- 1Condition number zero or a number exceeding the number of available conditions was specified.
How to reproduce
trigger — this will error
trigger — this will error
GET DIAGNOSTICS CONDITION 0 @msg = MESSAGE_TEXT; -- condition 0 is invalid
expected output
ERROR 1758 (HY000): Invalid condition number.
Fix
Use condition numbers starting from 1 and not exceeding the diagnostics area size
Use condition numbers starting from 1 and not exceeding the diagnostics area size
GET DIAGNOSTICS @cnt = NUMBER; GET DIAGNOSTICS CONDITION 1 @msg = MESSAGE_TEXT;
Why this works
Condition numbers are 1-based and bounded by the number of conditions raised.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1758 ER_DA_INVALID_CONDITION_NUMBER
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev