This Db2 error means that the SQL statement references a database object that Db2 cannot find. This may be due to a typo, an incorrect schema, or the object not existing at all. It can occur with tables, views, aliases, indexes, or even functions and procedures.
The error may also appear if:
The associated SQLSTATE 42704
confirms it's an object resolution issue.
Q: Why does this happen if I just created the table?
A: It may not be committed yet in your current session, or you might be referencing it in a different schema than where it was created.
Q: How do I know what schema I'm using?
A: Run SELECT CURRENT SCHEMA FROM SYSIBM.SYSDUMMY1;
to check. Always qualify with schema.object
if unsure.
Q: Can this error come from a missing UDF or stored procedure?
A: Yes—SQLCODE -204 applies to any object type, including functions, procedures, views, and tables.