Informix Error -673
-673 Routine routine-name already exists in database.
You attempted to create a routine that already exists in the database. If you want to create a new version of the routine, use the DROP ROUTINE statement to drop the routine before you attempt to create the new version of the routine.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-673 fires when CREATE PROCEDURE/CREATE FUNCTION names a routine that already exists — per
the official guidance, CREATE doesn't implicitly replace an existing routine of the same name.
- A
CREATE PROCEDURE/CREATE FUNCTIONre-run without dropping the previous version first, per the official guidance — the direct, common cause during iterative development. - Two different developers/deployments creating a routine under the same name independently, without realizing it already existed.
- A deployment script re-run against an environment where it had already succeeded once, attempting to create routines that are already present.
Solutions / Resolution
- Use
DROP ROUTINEto drop the existing routine first, per the official guidance, before creating the new version:DROP ROUTINE orders_status_check; CREATE PROCEDURE orders_status_check(p_order_id INT) ...; - Or use
CREATE OR REPLACE PROCEDURE/CREATE OR REPLACE FUNCTIONif the deployment process should always overwrite an existing routine rather than fail when one exists (check this syntax's availability on the specific server version in use). - Make deployment scripts idempotent by dropping-if-exists (or using
CREATE OR REPLACE) before everyCREATE ROUTINE, if they may run more than once against the same database.
Examples
Hitting the restriction
CREATE PROCEDURE orders_status_check(p_order_id INT) ...;
-- run a second time:
CREATE PROCEDURE orders_status_check(p_order_id INT) ...;
-- -673: orders_status_check already exists
Corrected — drop first
DROP ROUTINE orders_status_check;
CREATE PROCEDURE orders_status_check(p_order_id INT) ...;
Diagnostic Checks
- Query
sysproceduresto confirm whether the routine already exists before attempting to create it:SELECT procname, owner FROM sysprocedures WHERE procname = 'orders_status_check';
Related Errors / Related Topics
- -657 — "Cannot create a procedure within a procedure." A related
CREATE PROCEDURErestriction, about nesting rather than a name collision. - -674 — "Routine routine-name cannot be resolved." The mirror-image situation for calling a routine: one that can't be found or invoked, rather than one that already exists.
Drop the existing routine first, or make deployment scripts idempotent via CREATE OR REPLACE
where available.