Informix Error -26029: GOTO cannot be used, and labels cannot be defined, within an exception h andler.
Cause and resolution
GOTO cannot be used, and labels cannot be defined, within an exception h andler.
Rewrite the exception handler block so that it includes no GOTO statements.
Example of error:
CREATE PROCEDURE testproc() BEGIN ON EXCEPTION IN (-206) <<ex_label>> -- error CREATE TABLE emp_list (lname CHAR(15)); GOTO ex_label; -- error INSERT INTO emp_list VALUES ('john'); END EXCEPTION WITH RESUME INSERT INTO emp_list VALUES ('john'); END ... </ex_label>
... END PROCEDURE;
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-26029 fires when a GOTO statement or a label definition appears inside an SPL ON EXCEPTION handler block — per the official guidance.
- A
GOTOstatement or label definition inside anON EXCEPTION ... END EXCEPTIONblock, per the official guidance — the direct, only cause; neither is allowed there.
Solutions / Resolution
- Rewrite the exception handler block so it includes no
GOTOstatements or label definitions, per the official guidance.
Examples
A GOTO inside an exception handler
CREATE PROCEDURE testproc()
BEGIN
ON EXCEPTION IN (-206)
<<ex_label>> -- -26029: label inside handler
CREATE TABLE emp_list (lname CHAR(15));
GOTO ex_label; -- -26029: GOTO inside handler
INSERT INTO emp_list VALUES ('john');
END EXCEPTION WITH RESUME
INSERT INTO emp_list VALUES ('john');
END
END PROCEDURE;
Corrected
CREATE PROCEDURE testproc()
BEGIN
ON EXCEPTION IN (-206)
CREATE TABLE emp_list (lname CHAR(15));
INSERT INTO emp_list VALUES ('john');
END EXCEPTION WITH RESUME
INSERT INTO emp_list VALUES ('john');
END
END PROCEDURE;
Diagnostic Checks
- Search every
ON EXCEPTION ... END EXCEPTIONblock forGOTOstatements or label definitions, and remove/rewrite them.
Related Errors / Related Topics
- -26027 — "Label label-name specified on a GOTO statement is not valid." A related
GOTO/label restriction, on an undefined label outside an exception handler rather thanGOTO/labels being disallowed inside one.
A GOTO statement or label was used inside an SPL exception handler — neither is allowed
there; rewrite the block.