Informix Error -4658: Constants are not allowed as cursor names.
Cause and resolution
Constants are not allowed as cursor names.
Identifiers that are used for dynamic cursor names must be variables.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-4658 fires when a dynamic cursor name is given as a constant rather than a variable — per the official guidance, identifiers used for dynamic cursor names must be variables.
- A constant used where a dynamic cursor name is expected, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use a variable holding the cursor name instead of a constant, per the official guidance.
Examples
A constant used as a dynamic cursor name
DECLARE "orders_cur" CURSOR FOR mystmt
-- -4658: "orders_cur" is a constant, not a variable
Corrected
DEFINE cur_name CHAR(20)
LET cur_name = "orders_cur"
DECLARE cur_name CURSOR FOR mystmt
Diagnostic Checks
- Check every dynamic cursor name reference, and confirm it's a variable rather than a literal/constant.
Related Errors / Related Topics
- -4371 — "Cursors must be uniquely declared within one program module." A related cursor-declaration restriction, about name uniqueness rather than the name's kind (variable vs. constant).
- -4303 — "A blob variable or cursor name expected." A related cursor-name error, about the wrong kind of value entirely rather than a constant used where a variable is required.
A dynamic cursor name was given as a constant rather than a variable — use a variable instead.