Informix Error -1375: SQL NULL value in aggregate or mode ANSI database warning.
Cause and resolution
SQL NULL value in aggregate or mode ANSI database warning.
The program set WHENEVER WARNING STOP, and a warning condition arose. If the statement that is involved is a DATABASE statement, the condition is that the database that was just opened is ANSI compliant. On any other statement, the condition is that a null value has been used in the computation of an aggregate value.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1375 fires when a program has WHENEVER WARNING STOP set and a warning condition
arises — per the official guidance, on a DATABASE statement the warning means the opened
database is ANSI-compliant; on any other statement, it means a NULL value was used in an
aggregate computation.
- The opened database being ANSI-compliant, per the official guidance's specific
DATABASE-statement case — a warning, not necessarily a problem, but oneWHENEVER WARNING STOPtreats as an error. - A
NULLvalue included in an aggregate computation, per the official guidance's general case for other statements — aggregates likeSUM/AVGsilently skipNULLs, and this warning flags that it happened.
Solutions / Resolution
- If triggered by
DATABASE, confirm whether ANSI mode is expected for that database, and adjustWHENEVER WARNINGhandling if it's not actually a problem. - If triggered by another statement, review whether
NULLvalues in the aggregated column are expected, and decide whether that's acceptable or needs filtering.
Examples
Distinguishing the two cases
WHENEVER WARNING STOP
DATABASE stores7
-- -1375 here means: stores7 is an ANSI-compliant database
SELECT AVG(total) INTO v_avg FROM orders;
-- -1375 here (a different statement) means: some total values were NULL
Diagnostic Checks
- Identify which statement triggered the warning — a
DATABASEstatement means ANSI mode; any other statement means aNULLin an aggregate.
Related Errors / Related Topics
- -1374 — "SQL character truncation or transaction warning." A related
WHENEVER WARNING STOPwarning, sharing the sameDATABASE-statement-vs.-other-statement interpretation split.
Depends on which statement triggered it — DATABASE means ANSI mode; any other statement means
a NULL in an aggregate.