Informix Error -385
-385 Data value out of range.
This statement attempts to put data into a view that was defined WITH CHECK OPTION, so new data has to satisfy the tests in the WHERE clause in the view. However, one or more of the data values in this current statement does not meet that test, so the alteration was not performed. Roll back the current transaction. To see what tests new data must satisfy, display the definition of the view, as follows:
SELECT seqno, viewtext FROM sysviews, systables WHERE systables.tabname = 'viewname' AND systables.tabid = sysviews.tabid ORDER BY seqno
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-385 fires on INSERT/UPDATE against a view created WITH CHECK OPTION: the new or modified
row's values don't satisfy the view's own WHERE clause, so the row would effectively "disappear"
from the view immediately after being written — CHECK OPTION exists specifically to prevent
that, and the operation is rejected instead.
- An
INSERTthrough aWITH CHECK OPTIONview supplying values that don't match the view'sWHEREclause — the direct, most common cause. - An
UPDATEthrough such a view changing a column referenced in theWHEREclause to a value outside the view's defined range/condition. - Application logic unaware the target is a
CHECK OPTIONview, and not validating input against the view's filtering condition before attempting the write.
Solutions / Resolution
- Roll back the transaction, per the official guidance, since the operation won't be performed.
- Review the view's
WHEREclause condition to understand exactly what values are permitted:SELECT v.viewtext FROM systables t, sysviews v WHERE t.tabid = v.tabid AND t.tabname = 'active_customers'; - Adjust the data being written to satisfy the view's condition, or write directly to the underlying base table if the value genuinely needs to fall outside the view's filtered range.
Examples
An insert that violates the view's CHECK OPTION condition
CREATE VIEW active_customers AS
SELECT * FROM customers WHERE status = 'active'
WITH CHECK OPTION;
INSERT INTO active_customers (customer_id, name, status)
VALUES (501, 'Acme Corp', 'inactive');
-- -385: status = 'inactive' doesn't satisfy the view's WHERE clause
Fix — supply a value consistent with the view's condition:
INSERT INTO active_customers (customer_id, name, status)
VALUES (501, 'Acme Corp', 'active');
Reviewing the view's definition to understand its constraint
SELECT v.viewtext FROM systables t, sysviews v
WHERE t.tabid = v.tabid AND t.tabname = 'active_customers';
Diagnostic Checks
- Check whether the target view was created
WITH CHECK OPTION. - Review the view's
WHEREclause and compare it against the values being written.
Related Errors / Related Topics
- -322 — "Cannot Alter view, Rename view or Create a trigger on a view." A related view
restriction, reinforcing that
CHECK OPTIONviews have their own distinct set of rules. - -384 — "Cannot modify non simple view." A related view-modification restriction, though
about structural complexity rather than a
CHECK OPTIONvalue violation.
Check the view's WHERE clause first — the data being written has to satisfy it, or the write is
rejected outright rather than silently producing a row invisible through the view.