← All errors

SQLCODE -811

SQL0811 SELECT returns more than one row

IBM message text
Result of SELECT more than one row.
SQLCODE
-811
SQLSTATE
21000

Most common cause

A SELECT INTO, or a subquery used in a comparison, returns more than one row.

Other causes

  • A key thought to be unique, with no UNIQUE constraint, that over time got duplicates.

How to fix it

Narrow the WHERE, add FETCH FIRST 1 ROW ONLY if any row will do, or use a cursor. For subqueries use IN or EXISTS.

Related errors

Text and codes from IBM documentation for 7.6. Checked on .