Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e53b01e

Browse files
committed
Fixed a bug with capturing DBMS_OUTPUT before test run.
1 parent 1175203 commit e53b01e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

source/core/ut_utils.pkb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,28 +437,29 @@ procedure append_to_clob(a_src_clob in out nocopy clob, a_clob_table t_clob_tab,
437437
procedure save_dbms_output_to_cache is
438438
l_status number;
439439
l_line varchar2(32767);
440-
l_line_no integer := 1;
440+
l_offset integer := 0;
441441
l_lines ut_varchar2_rows := ut_varchar2_rows();
442442
c_lines_limit constant integer := 100;
443443
pragma autonomous_transaction;
444444

445-
procedure flush_lines is
445+
procedure flush_lines(a_lines ut_varchar2_rows, a_offset integer) is
446446
begin
447447
insert into ut_dbms_output_cache (seq_no,text)
448-
select rownum, column_value
449-
from table(l_lines);
450-
l_lines.delete;
448+
select rownum+a_offset, column_value
449+
from table(a_lines);
451450
end;
452451
begin
453452
loop
454453
dbms_output.get_line(line => l_line, status => l_status);
455454
exit when l_status = 1;
456455
l_lines := l_lines multiset union all ut_utils.convert_collection(ut_utils.clob_to_table(l_line||chr(7),4000));
457456
if l_lines.count > c_lines_limit then
458-
flush_lines();
457+
flush_lines(l_lines, l_offset);
458+
l_offset := l_offset + l_lines.count;
459+
l_lines.delete;
459460
end if;
460461
end loop;
461-
flush_lines();
462+
flush_lines(l_lines, l_offset);
462463
commit;
463464
end;
464465

0 commit comments

Comments
 (0)