DB2 - Problem description
Problem IC69790 | Status: Closed |
PL/SQL: CONTINUE STATEMENT IN FOR LOOP CAUSES INFINITE LOOP. | |
product: | |
DB2 FOR LUW / DB2FORLUW / 970 - DB2 | |
Problem description: | |
If PL/SQL contains CONTINUE statement in FOR loop, it stops responding (hangs). The following steps illustrates one of the scenario causing this problem. 1. Create a Oracle compatible database. $ db2set DB2_COMPATIBILITY_VECTOR=ORA $ db2stop $ db2start $ db2sampl 2. Create a PL/SQL procedure. $ db2 connect to sample $ db2 set sqlcompat plsql $ db2 -tvf p1.sql ------------------------------ create or replace procedure P1 is begin for r in 1..5 loop CONTINUE when r=3; dbms_output.put_line(r); end loop; end; / ------------------------------ 3. Run the procedure. $ db2 set serveroutput on $ db2 call P1 The procesure call never returns, but the user can interrupt it by Ctrl+C. | |
Problem Summary: | |
**************************************************************** * USERS AFFECTED: * * users who use PL/SQL with CONTINUE statement in FOR LOOP. * **************************************************************** * PROBLEM DESCRIPTION: * * If PL/SQL contains CONTINUE statement in FOR loop, it stops * * responding (hangs). * * The following steps illustrates one of the scenario causing * * this problem. * * * * 1. Create a Oracle compatible database. * * $ db2set DB2_COMPATIBILITY_VECTOR=ORA * * $ db2stop * * $ db2start * * $ db2sampl * * * * 2. Create a PL/SQL procedure. * * $ db2 connect to sample * * $ db2 set sqlcompat plsql * * $ db2 -tvf p1.sql * * ------------------------------ * * create or replace procedure P1 * * is * * begin * * for r in 1..5 loop * * CONTINUE when r=3; * * dbms_output.put_line(r); * * end loop; * * end; * * / * * ------------------------------ * * * * 3. Run the procedure. * * $ db2 set serveroutput on * * $ db2 call P1 * * * * The procesure call never returns, but the user can interrupt * * it by Ctrl+C. * **************************************************************** * RECOMMENDATION: * * Please upgrade to V9.7 fixpack 4 or later. * **************************************************************** | |
Local Fix: | |
Please rewrite the PL/SQL procedure like as below: create or replace procedure P1 is begin for r in 1..5 loop if r=3 then goto LOOP_END; end if; dbms_output.put_line(r); <<LOOP_END>> null; end loop; end; / | |
available fix packs: | |
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows | |
Solution | |
This problem is first fixed in DB2 V9.7 fixpack 4. | |
Workaround | |
not known / see Local fix | |
Timestamps | |
Date - problem reported : Date - problem closed : Date - last modified : | 09.07.2010 12.05.2011 12.05.2011 |
Problem solved at the following versions (IBM BugInfos) | |
9.7.FP4 | |
Problem solved according to the fixlist(s) of the following version(s) | |
9.7.0.4 |