Content-Length: 376459 | pFad | http://github.com/utPLSQL/utPLSQL/commit/#start-of-content

687B64D8 Merge pull request #1295 from utPLSQL/feature/issue_1293 · utPLSQL/utPLSQL@e872b30 · GitHub
Skip to content

Commit e872b30

Browse files
authored
Merge pull request #1295 from utPLSQL/feature/issue_1293
Enable duplicate detection on cursor comparison using join by
2 parents 31604c6 + 6f273df commit e872b30

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ create or replace package body ut_compound_data_helper is
300300
ut_utils.append_to_clob(a_partition_stmt,' row_number() over (partition by '||l_partition_tmp||' order by '||l_partition_tmp||' ) ');
301301

302302
if a_pk_table.count > 0 then
303-
-- If key defined do the join or these and where on diffrences
304-
a_join_by_stmt := ut_utils.table_to_clob(l_join_by_list, ' and ');
303+
-- If key defined do the join or these and where on diffrences as well as on duplicate number when rows are same.
304+
a_join_by_stmt := ' e."UT3$_Dup#No" = a."UT3$_Dup#No" and '||ut_utils.table_to_clob(l_join_by_list, ' and ');
305305
elsif a_unordered then
306306
-- If no key defined do the join on all columns
307307
a_join_by_stmt := ' e."UT3$_Dup#No" = a."UT3$_Dup#No" and '||ut_utils.table_to_clob(l_equal_list, ' and ');

test/ut3_user/expectations/test_expectations_cursor.pkb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,5 +2950,47 @@ Rows: [ 2 differences ]
29502950
);
29512951
end;
29522952

2953+
procedure cr_joinby_compare_issue_1293 is
2954+
l_actual sys_refcursor;
2955+
l_expected sys_refcursor;
2956+
begin
2957+
--Arrange
2958+
open l_expected for
2959+
select 'FOO' username, 12 from dual union all
2960+
select 'TEST' username, -600 user_id from dual
2961+
order by 1 desc;
2962+
open l_actual for
2963+
select 'FOO' username, 12 from dual union all
2964+
select 'TEST' username, -600 user_id from dual union all
2965+
-- DUPLICATE!!!
2966+
select 'TEST' username, -600 user_id from dual
2967+
order by 1 asc;
2968+
--Act
2969+
ut3_develop.ut.expect(l_actual).to_equal(l_expected).join_by('USERNAME');
2970+
--Assert
2971+
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2972+
end;
2973+
2974+
procedure cr_not_joinby_comp_issue_1293 is
2975+
l_actual sys_refcursor;
2976+
l_expected sys_refcursor;
2977+
begin
2978+
--Arrange
2979+
open l_expected for
2980+
select 'FOO' username, 12 from dual union all
2981+
select 'TEST' username, -600 user_id from dual
2982+
order by 1 desc;
2983+
open l_actual for
2984+
select 'FOO' username, 12 from dual union all
2985+
select 'TEST' username, -600 user_id from dual union all
2986+
-- DUPLICATE!!!
2987+
select 'TEST' username, -600 user_id from dual
2988+
order by 1 asc;
2989+
--Act
2990+
ut3_develop.ut.expect(l_actual).to_equal(l_expected);
2991+
--Assert
2992+
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2993+
end;
2994+
29532995
end;
29542996
/

test/ut3_user/expectations/test_expectations_cursor.pks

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,5 +485,11 @@ create or replace package test_expectations_cursor is
485485
--%test( Multiple failures reported correctly - Issue #998 )
486486
procedure multiple_cursor_expectations;
487487

488+
--%test( Compares cursors with duplicate rows using join by - Issue #1293 )
489+
procedure cr_joinby_compare_issue_1293;
490+
491+
--%test( Compares cursors with duplicate rows - Issue #1293 )
492+
procedure cr_not_joinby_comp_issue_1293;
493+
488494
end;
489495
/

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/utPLSQL/utPLSQL/commit/#start-of-content

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy