home clear 64x64
en blue 200x116 de orange 200x116 info letter User
suche 36x36
Neueste VersionenFixList
11.1.0.7 FixList
10.5.0.9 FixList
10.1.0.6 FixList
9.8.0.5 FixList
9.7.0.11 FixList
9.5.0.10 FixList
9.1.0.12 FixList
Haben Sie Probleme? - Kontaktieren Sie uns.
Kostenlos registrieren anmeldung-x26
Kontaktformular kontakt-x26

DB2 - Problembeschreibung

Problem IC65201 Status: Geschlossen

DB2 CAN NOT HOOK NO_DATA_FOUND INSIDE OF A FOR CURSOR LOOP IN PL/SQL.

Produkt:
DB2 FOR LUW / DB2FORLUW / 970 - DB2
Problembeschreibung:
The following PL/SQL script does not display the "Bottom of FOR 
loop" message.  Assume that table TEST2 contains one or more 
rows, and that TEST1 is empty: 
 
create or replace procedure cursor_test 
is 
        cursor c2 is 
                select col1 from test2; 
        testv   varchar2(10); 
begin 
        for c2_rec in c2 loop 
                dbms_output.put_line('Top of FOR loop'); 
                begin 
                        select col1 into testv from test1; 
                exception 
                        when no_data_found then 
                                dbms_output.put_line('NO DATA 
FOUND'); 
                        when others then 
                                null; 
                end; 
                dbms_output.put_line('Bottom of FOR loop'); 
        end loop; 
end; 
/ 
 
After the first execution of the SELECT ... INTO statement, the 
FOR loop exits prematurely and the exception clause for 
NO_DATA_FOUND is not run.
Problem-Zusammenfassung:
**************************************************************** 
* USERS AFFECTED:                                              * 
* ALL.                                                         * 
**************************************************************** 
* PROBLEM DESCRIPTION:                                         * 
* See the APAR description.                                    * 
**************************************************************** 
* RECOMMENDATION:                                              * 
* Upgrade to DB2 UDB version 9.7 fixpack 2.                    * 
****************************************************************
Local-Fix:
Wrap the SELECT ... INTO statement in a separate PL/SQL 
function, then invoke this function to obtain the column value; 
for example: 
 
create or replace function get_test1_col1 return varchar2(2) 
as 
  declare v varchar2(2); 
begin 
  select col1 into v from test1; 
  return v; 
end; 
/ 
 
-- In the calling procedure... 
 
  for c2_rec in c2 loop 
    dbms_output.put_line('Top of FOR loop'); 
 
    begin 
      testv := get_test1_col1; 
    exception 
      when no_data_found then 
        dbms_output.put_line('NO_DATA_FOUND'); 
      when others then 
        null; 
    end; 
 
This will produce the intended behaviour.
verfügbare FixPacks:
DB2 Version 9.7 Fix Pack 2 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 3a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 4 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 5 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 6 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 7 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9a for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 8 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 9 for Linux, UNIX, and Windows
DB2 Version 9.7 Fix Pack 10 for Linux, UNIX, and Windows

Lösung
Problem was first fixed in DB2 UDB Version 9.7 FixPack 2.
Workaround
See LOCAL FIX.
Bug-Verfolgung
Vorgänger  : APAR is sysrouted TO one or more of the following: IC66926 
Nachfolger : 
Weitere Daten
Datum - Problem gemeldet    :
Datum - Problem geschlossen :
Datum - der letzten Änderung:
17.12.2009
17.05.2010
17.05.2010
Problem behoben ab folgender Versionen (IBM BugInfos)
9.7.FP2
Problem behoben lt. FixList in der Version
9.7.0.2 FixList