Master Mainframe Technologies - COBOL, JCL, DB2, VSAM, CICS & More
ABEND Codes SQLCODEs File Status Interview Prep Contact
← Back to SQLCODE Reference
Error

SQLCODE -122

SELECT INTO returns multiple rows

Explanation

A SELECT INTO statement returned more than one row when only one was expected.

Solution

Add WHERE clause to limit to one row, use MIN/MAX, or use cursor for multiple rows.

Example

SELECT NAME INTO :WS-NAME FROM EMP WHERE DEPTNO = 10 -- Multiple employees