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

Skip to content

Commit b7ac3a4

Browse files
committed
Improved feedback on refcursor comparison
1 parent bab7da8 commit b7ac3a4

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

source/expectations/data_values/ut_data_value_refcursor.tpb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,27 @@ create or replace type body ut_data_value_refcursor as
102102
overriding member function to_string return varchar2 is
103103
type t_clob_tab is table of clob;
104104
l_results t_clob_tab;
105-
c_max_rows constant integer := 10;
105+
c_max_rows constant integer := 50;
106106
l_result clob;
107107
l_result_xml xmltype;
108108
l_result_string varchar2(32767);
109109
l_ut_owner varchar2(250) := ut_utils.ut_owner;
110+
l_diff_row_count integer;
110111
begin
111112
dbms_lob.createtemporary(l_result,true);
113+
-- First tell how many rows are different
114+
execute immediate 'select count(*) from ' || l_ut_owner || '.ut_cursor_data_diff' into l_diff_row_count;
115+
116+
ut_utils.append_to_clob(l_result,'Rows: ' || to_char(self.ROW_COUNT)
117+
|| ', different: ' || to_char(l_diff_row_count) || chr(10));
118+
112119
--return rows which were previously marked as different
113120
execute immediate 'select xmlserialize( content ucd.row_data no indent)
114121
from ' || l_ut_owner || '.ut_cursor_data ucd
115122
where ucd.cursor_data_guid = :self_guid
116-
and ucd.row_no in (select row_no from ' || l_ut_owner || '.ut_cursor_data_diff ucdc)'
117-
bulk collect into l_results using in self.data_value;
123+
and ucd.row_no in (select row_no from ' || l_ut_owner || '.ut_cursor_data_diff ucdc)
124+
and rownum <= :max_rows'
125+
bulk collect into l_results using in self.data_value, c_max_rows;
118126

119127
for i in 1 .. l_results.count loop
120128
dbms_lob.append(l_result,l_results(i));
@@ -142,7 +150,8 @@ create or replace type body ut_data_value_refcursor as
142150
l_xpath := coalesce(self.exclude_xpath, l_other.exclude_xpath);
143151
if a_other is of (ut_data_value_refcursor) then
144152
l_other := treat(a_other as ut_data_value_refcursor);
145-
153+
154+
-- Find differences
146155
execute immediate 'insert into ' || l_ut_owner || '.ut_cursor_data_diff ( row_no )
147156
select nvl(exp.row_no, act.row_no)
148157
from (select case when :l_xpath is not null then deletexml( ucd.row_data, :l_xpath ) else ucd.row_data end as row_data,

0 commit comments

Comments
 (0)