SELECT statements to stop the execution of
SELECT loop is an expensive
and ineffective way to filter data. Filtering should be part of the
SELECT loop themselves. Most of the time conditions located in a
CHECK statement should be moved to the
WHERE clause, and the
EXIT statement should typically be replaced by an
UP TO 1 ROW clause.
Noncompliant Code Example
SELECT * FROM SBOOK INTO SBOOK_WA.
CHECK: SBOOK_WAS-CARRID = 'LH' AND SBOOK_WAS-CONNID = '0400'. "Noncompliant
SELECT * FROM SBOOK INTO SBOOK_WA WHERE CARRID = 'LH' AND CONNID = '0400'.