Informix Error -9848: Functional key part cannot use a variant function function_name.
Cause and resolution
Functional key part cannot use a variant function function_name.
The function used in a CREATE INDEX statement for a functional key part must be a nonvariant function (that is, it must be created with the NOT VARIANT modifier in the CREATE FUNCTION statement).
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-9848 fires when a functional key part in a CREATE INDEX statement uses a variant function — per the official guidance.
- A function created without the NOT VARIANT modifier used as a functional key part, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use a nonvariant function — one created with NOT VARIANT in its CREATE FUNCTION statement, per the official guidance.
Examples
A variant function in a functional key
CREATE FUNCTION my_func(a INT) RETURNING INT VARIANT ...;
CREATE INDEX idx1 ON tab(my_func(col)); -- -9848
Corrected
CREATE FUNCTION my_func(a INT) RETURNING INT NOT VARIANT ...;
CREATE INDEX idx1 ON tab(my_func(col));
Diagnostic Checks
- Check the function's VARIANT/NOT VARIANT modifier, and change it to NOT VARIANT if it needs to back a functional index.
Related Errors / Related Topics
- -9843 — "Invalid number of arguments for functional key." A related functional-key validity error, on argument count rather than the function being variant.
- -9844 — "Invalid function function_name used in a functional key." The general invalid-functional-key-function error this is a specific case of, for variant functions.
A functional key part used a variant function, which isn't allowed — mark the function NOT VARIANT.