Use SELECT + THE in preference to a WHILE loop where possible when searching through an internal table of values.
For example – the following has a loop |
SET intItems = CARDINALITY(inRef.Order_line[]); SET intLoop = 1; –Below WHILE loop can be replaced with SELECT THE |
Could be replaced by this code |
SET outRef.Order_type = THE ( SELECT ITEM ‘PRE_PAID’ FROM inRef.Order_line[] AS orderLineItem WHERE TRIM(orderLineItem.MOD) = ‘TC’ ); |