Informix Error -8301: Sequence <sequence-name> already exists in the database. </sequence-name>
Cause and resolution
Sequence <sequence-name> already exists in the database. </sequence-name>
This statement tries to create a table or sequence object with the name that is shown, but a sequence object with that name already exists. Only one table or sequence object with a given name can exist in a single database. (In an ANSI-compliant database, the name of the user that created a table or sequence object name qualifies it, so one table or sequence object of a given name per user can exist.)
Check the spelling of the name; if it is as you intended, and you are sure it should not exist, check that you are using the right database. You can review the names of all tables and sequence objects in this database by querying systables as follows:
SELECT tabname FROM systables WHERE tabid > 99
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-8301 fires when creating a table or sequence with a name already used by a sequence object — per the official guidance, only one table or sequence object with a given name can exist per database (or per user, in an ANSI-compliant database).
- A table/sequence name colliding with an existing sequence object, per the official guidance — the direct, only cause.
Solutions / Resolution
- Check the spelling of the name, per the official guidance, and confirm the intended database is selected.
- Review existing tables/sequences via
systables, per the official guidance:SELECT tabname FROM systables WHERE tabid > 99
Examples
Listing existing tables and sequences
SELECT tabname FROM systables WHERE tabid > 99;
Diagnostic Checks
- Check
systablesfor the name, and confirm the current database and (in ANSI mode) the owning user.
Related Errors / Related Topics
- -8300 — "The specified sequence object
is not in the database." The complementary condition — a sequence not being found, rather than a name collision.
A table/sequence name collides with an existing sequence object — check systables and
choose a different name.