We have an SQL SELECT statement that retrieves over 400 fields from more than 120 joined tables. The query executes successfully on other database systems (Oracle 19c and Microsoft SQL Server 2019). However, when running the same query on Db2 for i, it fails with error SQL0904, which references a job log entry containing message ID CPD4365.
The job log indicates reason code 3: “More than 65535 bytes in an internal buffer.”
If we remove just a few columns from the SELECT clause—regardless of which ones—the query executes successfully again.
What causes this internal buffer limit in Db2 for i, and are there options to avoid the SQL0904 error and support the required number of columns?
