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

Skip to content

Commit 87ce4c7

Browse files
authored
Merge pull request #678 from utPLSQL/bugfix/cursor_package_type_numbercol
Test to verify The problem with cursor-comparison on 12.1 is now resolved.
2 parents 8a7bf6f + 63bc825 commit 87ce4c7

4 files changed

Lines changed: 57 additions & 2 deletions

File tree

test/core/expectations/compound_data/test_expectations_cursor.pkb

Whitespace-only changes.

test/core/expectations/compound_data/test_expectations_cursor.pks

Whitespace-only changes.

test/ut3_user/expectations/test_expectations_cursor.pkb

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2788,6 +2788,48 @@ Check the query and data for errors.';
27882788
ut3.ut.expect(l_actual).to_equal(l_expected);
27892789
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
27902790
end;
2791-
2791+
2792+
procedure compare_number_pckg_type
2793+
as
2794+
l_expected sys_refcursor;
2795+
l_actual sys_refcursor;
2796+
l_expected_data t_num_tab;
2797+
l_actual_message varchar2(32767);
2798+
l_expected_message varchar2(32767);
2799+
begin
2800+
2801+
l_expected_data(1).col1 := 2135;
2802+
l_expected_data(1).col4 := 2016;
2803+
l_expected_data(1).col5 := -1;
2804+
2805+
--Select on package level nested table types supported only since Oracle 12
2806+
$if dbms_db_version.version >= 12 $then
2807+
open l_expected for
2808+
select *
2809+
from table (l_expected_data);
2810+
2811+
open l_actual for
2812+
select
2813+
1 as col1
2814+
,2 as col2
2815+
,3 as col3
2816+
,2016 as col4
2817+
,-1 as col5
2818+
from dual;
2819+
2820+
ut3.ut.expect(l_actual).to_equal(a_expected => l_expected);
2821+
2822+
l_expected_message := q'[%Actual: refcursor [ count = 1 ] was expected to equal: refcursor [ count = 1 ]
2823+
%Diff:
2824+
%Rows: [ 1 differences ]
2825+
%Row No. 1 - Actual: <COL1>1</COL1><COL2>2</COL2><COL3>3</COL3>
2826+
%Row No. 1 - Expected: <COL1>2135</COL1><COL2/><COL3/>%]';
2827+
2828+
l_actual_message := ut3_tester_helper.main_helper.get_failed_expectations(1);
2829+
2830+
ut.expect(l_actual_message).to_be_like(l_expected_message);
2831+
$end
2832+
end;
2833+
27922834
end;
27932835
/

test/ut3_user/expectations/test_expectations_cursor.pks

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,19 @@ create or replace package test_expectations_cursor is
445445

446446
--%test(Check precision of number from dual #907)
447447
procedure number_from_dual;
448-
448+
449+
--%test( Comparing number types with different precisions works with package-type nested tables )
450+
procedure compare_number_pckg_type;
451+
452+
type t_num_rec is record (
453+
col1 number(15,0),
454+
col2 number(1,0),
455+
col3 number(4,0),
456+
col4 number(4,0),
457+
col5 number(38,0));
458+
459+
460+
type t_num_tab is table of t_num_rec index by binary_integer;
461+
449462
end;
450463
/

0 commit comments

Comments
 (0)