Informix Error -670
-670 Variable variable-name declared as SERIAL or SERIAL8 or BIGSERIAL type.
The SERIAL or SERIAL8 or BIGSERIAL data type is not a legal procedure type. Use the INTEGER or INT8 or BIGINT data type to match the SQL SERIAL or SERIAL8 or BIGSERIAL data type.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-670 fires when an SPL procedural variable is declared with SERIAL/SERIAL8/BIGSERIAL — per
the official guidance, these types are meaningful only for table columns (where the server
auto-generates the value); they aren't legal types for a procedural variable.
DEFINE var SERIAL/SERIAL8/BIGSERIAL, per the official guidance — the direct, only cause.- A variable declared to match a table column's type directly, carrying over the column's
SERIALfamily type without realizing procedural variables need the corresponding plain integer type instead.
Solutions / Resolution
- Use
INTEGER/INT8/BIGINTinstead, per the official guidance — matchingSERIAL→INTEGER,SERIAL8→INT8,BIGSERIAL→BIGINT. - If the variable is meant to hold a value read from a
SERIAL-family column, declare it as the corresponding plain integer type, since that's what actually gets stored in the variable once fetched — the auto-generation behavior is a column-level property, not something the variable itself needs to carry.
Examples
The disallowed declaration
CREATE PROCEDURE get_order_id()
RETURNING SERIAL;
DEFINE v_id SERIAL;
-- -670: SERIAL isn't a legal procedure/variable type
...
END PROCEDURE;
Corrected
CREATE PROCEDURE get_order_id()
RETURNING INTEGER;
DEFINE v_id INTEGER;
...
END PROCEDURE;
Diagnostic Checks
- Scan
DEFINE/RETURNINGdeclarations forSERIAL/SERIAL8/BIGSERIAL, and replace each with its corresponding plain integer type (INTEGER/INT8/BIGINT).
Related Errors / Related Topics
- -593 — "Cannot specify default value for SERIAL or SERIAL8 or BIGSERIAL column." A related
restriction on
SERIAL-family types, in the table-column context rather than procedural variables.
SERIAL/SERIAL8/BIGSERIAL are column-only types — use INTEGER/INT8/BIGINT for
procedural variables and return types.