RPG (IBM i / AS/400) · DB2 SQLCODE

SQLCODE -811 - More Than One Row Returned

What does SQLCODE -811 - More Than One Row Returned mean in RPG (IBM i / AS/400)?

A SELECT INTO, or a subquery used where only a single value is expected (such as inside a scalar comparison), returned more than one row from the underlying query.

SQLCODE -811 - More Than One Row ReturnedDB2 for i · SQLRPGLE

Condition

A SELECT INTO, or a subquery used where only a single value is expected (such as inside a scalar comparison), returned more than one row from the underlying query.

Fix

Add a WHERE clause or key condition that guarantees uniqueness for a SELECT INTO, or switch to a cursor and FETCH loop instead if the query can legitimately return multiple rows.

Related db2 sqlcode