Informix Error -1374: SQL character truncation or transaction warning.
Cause and resolution
SQL character truncation or transaction warning.
The program set WHENEVER WARNING STOP, and a warning condition arose. If the statement involved is a DATABASE statement, the condition is that the database that was just opened uses a transaction log. On any other statement, the condition is that a character value from the database had to be truncated to fit in its destination.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-1374 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 just-opened database uses
a transaction log; on any other statement, it means a character value from the database had to
be truncated to fit its destination.
- The just-opened database using a transaction log, per the official guidance's specific
DATABASE-statement case — a warning, not necessarily a problem, but oneWHENEVER WARNING STOPtreats as an error. - A character value truncated to fit its destination variable, per the official guidance's general case for other statements.
Solutions / Resolution
- If triggered by
DATABASE, confirm whether transaction logging is expected for that database, and adjustWHENEVER WARNINGhandling if it's not actually a problem. - If triggered by another statement, check the destination variable's size against the actual character value's length, and widen it if truncation is unacceptable.
Examples
Distinguishing the two cases
WHENEVER WARNING STOP
DATABASE stores7
-- -1374 here means: stores7 uses a transaction log
SELECT long_notes INTO v_short_notes FROM orders WHERE order_id = 1;
-- -1374 here (a different statement) means: long_notes was truncated to fit v_short_notes
Diagnostic Checks
- Identify which statement triggered the warning — a
DATABASEstatement means transaction logging; any other statement means character truncation.
Related Errors / Related Topics
- -1375 — "SQL NULL value in aggregate or mode ANSI database warning." A related
WHENEVER WARNING STOPwarning, sharing the sameDATABASE-statement-vs.-other-statement interpretation split.
Depends on which statement triggered it — DATABASE means transaction logging; any other
statement means character truncation.