Informix Error -24301: Table (%s) is not the target table.
Cause and resolution
Table (%s) is not 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, emp.bonus) VALUES (S.id, salary);
This will generate the following error because the emp.bonus table name is not the bonus target table:
24301: Table (emp) is not the target table. Error in line 4 Near character position 47
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-24301 fires when a MERGE INTO statement's INSERT column list qualifies a column with a
table name other than the actual target table — per the official guidance.
- An
INSERTcolumn list column qualified with a table name that isn't theMERGE's target table, per the official guidance — the direct, only cause.
Solutions / Resolution
- Qualify
INSERTcolumn-list columns with the target table's own name (or leave them unqualified), per the official guidance.
Examples
An INSERT column qualified with the source table's name
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, emp.bonus) VALUES (S.id, salary);
-- -24301: emp.bonus qualifies with emp, not the target table bonus
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.bonus) VALUES (S.id, salary);
Diagnostic Checks
- Check every table qualifier used in the
INSERTcolumn list, and confirm each names the actual target table.
Related Errors / Related Topics
- -24300 — "Column (%s) not found in the target table." A related
MERGE-statement restriction, on a column not belonging to the target table at all, rather than being correctly named but wrongly qualified. - -24302 — "Column (%s) not found in the source table." A related
MERGE-statement restriction, on theVALUESclause rather than theINSERTcolumn list. - -24303 — "Table (%s) is not the source table." The mirror-image error, for the
VALUESclause qualifying with the wrong table name.
A MERGE's INSERT column list qualified a column with a table name other than the actual
target table — qualify with the target table instead.