References to SQL condition names
The name of an SQL condition can be the same as the name of another SQL condition declared in the same routine.
This can occur when the two SQL conditions are declared in different
compound statements. The compound statement that contains the declaration
of an SQL condition name determines the scope of that condition name.
A condition name must be unique within the compound statement in which
it is declared, excluding any declarations in compound statements
that are nested within that compound statement (SQLSTATE 42734). A
condition name can only be referenced within the compound statement
in which it is declared, including any compound statements that are
nested within that compound statement. When there is a reference to
a condition name, the condition that is declared in the innermost
compound statement is the condition that is used. For more information,
see Compound SQL (inlined)
.