Informix Error -721
-721 SPL routine (<routine-name>) is no longer valid. </routine-name>
You are attempting to execute a procedure from an EXECUTE statement, but it has been redefined since the PREPARE statement was run. You must use the PREPARE statement again on the EXECUTE PROCEDURE statement.
For example, the following sequence of code would cause this error:
$prepare pr_stat from 'execute procedure testproc()'; ... /* drop procedure testproc create procedure testproc() ...... [same application or different] */ ... $execute pr_stat;/* triggers error -721 */
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-721 fires when EXECUTE PROCEDURE runs against a previously PREPAREd statement, but the
procedure was redefined (dropped and recreated, or altered) after the PREPARE and before this
EXECUTE — per the official guidance, the prepared statement's reference to the old procedure
definition is now stale.
- The procedure dropped and recreated between
PREPAREandEXECUTE, per the official guidance's own example — even an identical-looking redefinition invalidates the earlier prepare. - The procedure altered (its signature or body changed) in that same window.
- A long-lived prepared statement held across a deployment/migration that redefined procedures it referenced, without the application re-preparing afterward.
Solutions / Resolution
- Re-run the
PREPAREstatement, per the official guidance's documented correction, before the nextEXECUTE PROCEDURE. - Avoid holding a prepared statement for a procedure call across a window where that procedure might be redefined — re-prepare immediately before execution if there's any chance the procedure changed since the original prepare.
Examples
The disallowed sequence
PREPARE stmt_id FROM 'EXECUTE PROCEDURE update_order(?, ?)';
-- update_order gets redefined here (dropped and recreated, or altered)
EXECUTE stmt_id USING 42, 'shipped';
-- -721: update_order was redefined since PREPARE
Corrected — re-prepare after the redefinition
PREPARE stmt_id FROM 'EXECUTE PROCEDURE update_order(?, ?)';
-- update_order gets redefined
PREPARE stmt_id FROM 'EXECUTE PROCEDURE update_order(?, ?)';
EXECUTE stmt_id USING 42, 'shipped';
Diagnostic Checks
- Check whether the procedure named in the prepared statement was redefined (via
sysprocedures, comparing its current definition/timestamp if tracked) since thePREPAREran.
Related Errors / Related Topics
- -710 — "Table table-name has been dropped, altered, or renamed." The equivalent staleness error for a prepared statement referencing a table rather than an SPL routine.
- -673 — "Routine routine-name already exists in database." A related routine-lifecycle error, about the create-time collision that a redefinition (drop-then-create) would need to work around.
The same staleness problem as -710, but for a routine rather than a table — re-prepare after any redefinition of the called procedure.