PL/I · DB2 SQLCODE

SQLCODE -811: Subquery or Subselect Returned More Than One Row or Value

What does SQLCODE -811: Subquery or Subselect Returned More Than One Row or Value mean in PL/I?

An embedded SELECT INTO, a SET-clause subselect, or a subquery in a basic predicate that the PL/I program expects to return exactly one row (or one value) instead returned multiple rows, because the WHERE clause isn't as selective as the program assumes.

SQLCODE -811: Subquery or Subselect Returned More Than One Row or ValueDB2 for z/OS · PL/I (embedded SQL)

Condition

An embedded SELECT INTO, a SET-clause subselect, or a subquery in a basic predicate that the PL/I program expects to return exactly one row (or one value) instead returned multiple rows, because the WHERE clause isn't as selective as the program assumes.

Fix

Tighten the WHERE clause so it can only match one row, or restructure the statement to use a cursor with a fetch loop if returning multiple rows is actually valid for this case.

Related db2 sqlcode