Inline SQL PL
From SQL PL Guide for DB2
Inline SQL PL
Inline SQL PL is a subset of SQL PL. It can be used in atomic compound statements like User Defined Functions, Triggers or stand alone compound statements.
The following SQL PL statements are supported:
- DECLARE <variable>
- DECLARE <condition>
- FOR loop
- GET DIAGNOSTICS
- GOTO
- IF
- ITERATE
- LEAVE
- RETURN
- SET
- SIGNAL
- WHILE loop
PREPARE, EXECUTE, and EXECUTE IMMEDIATE is not supported in Inline SQL PL because the compound statements are already dynamic. CASE is just supported as expression not as CASE statement!
Instead of the LOOP and REPEAT statement it's possible to use the WHILE loop. Furthermore use the IF statement instead of CASE