After some back and forth with Patrick Barel and Steven Feuerstein, it became clear that it most likely is a bug with Qualified Expressions.
A simple case to reproduce the bug is below
SQL> set serveroutput on SQL> declare 2 type tbl_t is table of pls_integer 3 index by pls_integer; 4 l_tbl tbl_t; 5 l_idx pls_integer; 6 begin 7 for i in 1..3 8 loop 9 l_tbl := tbl_t (i => i); 10 end loop; 11 -- 12 l_idx := l_tbl.first; 13 while l_idx is not null 14 loop 15 sys.dbms_output.put_line (to_char (l_idx) 16 ||' - '|| 17 to_char (l_tbl(l_idx)) 18 ); 19 l_idx := l_tbl.next (l_idx); 20 end loop; 21 end; 22 / 1 - 1 2 - 2 3 - 3 PL/SQL procedure successfully completed.Why it is the above a bug? If you do the a similar assignment, but without a loop, the outcome is different (and most likely correct)
SQL> declare 2 type tbl_t is table of pls_integer 3 index by pls_integer; 4 l_tbl tbl_t; 5 l_idx pls_integer; 6 begin 7 l_tbl := tbl_t (1 => 1); 8 l_tbl := tbl_t (2 => 2); 9 l_tbl := tbl_t (3 => 3); 10 -- 11 l_idx := l_tbl.first; 12 while l_idx is not null 13 loop 14 sys.dbms_output.put_line (to_char (l_idx) 15 ||' - '|| 16 to_char (l_tbl(l_idx)) 17 ); 18 l_idx := l_tbl.next (l_idx); 19 end loop; 20 end; 21 / 3 - 3 PL/SQL procedure successfully completed.
Bug 32057533 - ASSIGNMENT TO COLLECTION USING QUALIFIED EXPRESSION APPENDS INSTEAD OF REPLACING.
No comments:
Post a Comment