RPG (IBM i / AS/400) · DB2 SQLCODE
What does SQLCODE +100 - No Data Found mean in RPG (IBM i / AS/400)?
A SELECT INTO, singleton FETCH, searched UPDATE, or searched DELETE found no matching row. In an SQLRPGLE program this is the SQL equivalent of end-of-file on a native READ - it just comes back through SQLCODE/SQLSTATE ('02000') instead of an indicator.
A SELECT INTO, singleton FETCH, searched UPDATE, or searched DELETE found no matching row. In an SQLRPGLE program this is the SQL equivalent of end-of-file on a native READ - it just comes back through SQLCODE/SQLSTATE ('02000') instead of an indicator.
After every FETCH or SELECT INTO, check SQLCODE = 100 the same way you'd check %EOF() on a native read, and exit the fetch loop or handle the not-found case explicitly instead of letting the next FETCH run against an exhausted cursor.