Informix Error -1391: Invalid class specified in AS clause.
Cause and resolution
Invalid class specified in AS clause.
The class specified in an AS clause of a NEW or COPY operation must be derived from the stated class.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1391 fires when the class named in a NEW/COPY operation's AS clause isn't actually
derived from the stated (parent) class — per the official guidance, the AS clause's class must
be a proper subclass of the class being created/copied.
- An
ASclause naming a class that doesn't inherit from the stated parent class, per the official guidance — the direct, only cause.
Solutions / Resolution
- Use a class in the
ASclause that's genuinely derived from the stated parent class, per the official guidance. - Review the class hierarchy if the intended inheritance relationship isn't actually what was designed.
Examples
An AS clause with an unrelated class
DEFINE v_obj Order.Class
LET v_obj = NEW Customer() AS Order.Class
-- -1391: Customer doesn't derive from Order.Class
Corrected
LET v_obj = NEW SpecialOrder() AS Order.Class
-- SpecialOrder genuinely derives from Order.Class
Diagnostic Checks
- Check the class hierarchy to confirm the
ASclause's class actually derives from the stated parent class.
Related Errors / Related Topics
- -1390 — "The class "class" has not been defined in any module in the program." A related class-definition error, about a class missing its definition entirely, rather than an incorrect inheritance relationship.
The AS clause's class doesn't derive from the stated parent class — check the class hierarchy.