Informix Error -24300: Column (%s) not found in the target table.
Cause and resolution
Column (%s) not found in the target table.
This error is generated when a user tries to insert into a column that is not from the target table. For example:
create table bonus (id int, bonus int); create table emp(id int, salary int);
MERGE INTO bonus D USING emp S ON D.id = S.id WHEN MATCHED THEN UPDATE SET bonus = bonus + salary*.01 WHEN NOT MATCHED THEN INSERT (id, salary) VALUES (S.id, salary);
This will generate the following error because salary in the insert column list is not from the target table, bonuses:
24300: Column (salary) not found in the target table. Error in line 4 Near character position 41
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-24300 fires when a MERGE INTO statement's INSERT column list names a column that isn't
from the target table — per the official guidance.
- A
MERGE'sINSERTcolumn list naming a column from the source table (or elsewhere) instead of the target table, per the official guidance — the direct, only cause.
Solutions / Resolution
- Change the
INSERTcolumn list to name only columns of the target table, per the official guidance.
Examples
An INSERT column list naming a source-table column
CREATE TABLE bonus (id INT, bonus INT);
CREATE TABLE emp (id INT, salary INT);
MERGE INTO bonus D
USING emp S ON D.id = S.id
WHEN MATCHED THEN UPDATE SET bonus = bonus + salary * .01
WHEN NOT MATCHED THEN INSERT (id, salary) VALUES (S.id, salary);
-- -24300: salary belongs to emp (the source), not bonus (the target)
Corrected
MERGE INTO bonus D
USING emp S ON D.id = S.id
WHEN MATCHED THEN UPDATE SET bonus = bonus + salary * .01
WHEN NOT MATCHED THEN INSERT (id, bonus) VALUES (S.id, salary);
Diagnostic Checks
- Check every column named in the
MERGE'sINSERTcolumn list, and confirm each belongs to the target table.
Related Errors / Related Topics
- -24112 — "Cannot update column (%s)." The same target-table-column restriction, for
a multi-table
UPDATE'sSETclause rather thanMERGE'sINSERTclause. - -24301 — "Table (%s) is not the target table." A related
MERGE-statement restriction, on qualifying a column with the wrong table name. - -24302 — "Column (%s) not found in the source table." The mirror-image error, for
the
VALUESclause naming a target-table column instead of a source-table one. - -24303 — "Table (%s) is not the source table." A related
MERGE-statement restriction, on theVALUESclause qualifying with the wrong table name.
A MERGE's INSERT column list named a column that isn't from the target table — use only
target-table columns there.