MySQL error 1319 occurs when a RESIGNAL or SIGNAL statement references an undefined CONDITION in a stored program.
MySQL Error 1319: ER_SP_COND_MISMATCH indicates that a SIGNAL or RESIGNAL statement points to a handler label or condition that has not been declared in the stored procedure or function. Declare the CONDITION or correct the reference to resolve the error.
Undefined CONDITION: %s
The server returns error 1319 when a SIGNAL or RESIGNAL statement tries to reference a CONDITION that is not defined in the current stored procedure, function, trigger, or event.
The undefined reference causes a compile-time failure, stopping the routine from being created or executed. The error belongs to SQLSTATE 42000, so MySQL treats it as a syntax or definition problem.
The mismatch is detected while the stored program is parsed. Most commonly it happens after editing an existing routine, moving condition declarations, or copying code fragments between databases without updating handler labels.
Developers often see it during deployment pipelines that automatically create or alter routines. Continuous-integration jobs will fail until the missing CONDITION is added or the reference is removed.
Unresolved SIGNAL targets block routine creation, halting application releases that depend on new procedures. If the routine is altered in place, production code may break, leading to runtime 1064 syntax errors or missing business logic.
Fixing the mismatch restores reliable error handling, keeps transaction logic intact, and ensures consistent rollbacks or diagnostics.
A SIGNAL references my_error
, but DECLARE my_error CONDITION FOR 45000
is absent.
CONDITION is declared in an inner BEGIN...END block, yet SIGNAL is issued outside that block where the label is invisible.
Condition label names or SQLSTATE codes are misspelled, creating an unintended reference.
Developers move handler declarations while leaving old SIGNAL statements untouched.
Thrown when a CONTINUE or EXIT handler references an undefined condition.
General parse error that may follow dropped condition declarations.
Raised when a routine references a local variable that does not exist.
Use DECLARE my_error CONDITION FOR SQLSTATE '45000';
or a numeric error code, then reference my_error
in SIGNAL or handlers.
Yes. Use SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT='Error';
to avoid declaring a label, but be consistent across code.
ER_SP_COND_MISMATCH appears in 5.5+ when stored programs gained SIGNAL support. The rules remain the same through 8.2.
Galaxy’s real-time parser flags undefined conditions and suggests declarations, reducing deployment failures.