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

Skip to content

Commit 80a46d0

Browse files
committed
Adding ROWID to list of types that do not provide a length.
1 parent 3428fa8 commit 80a46d0

4 files changed

Lines changed: 33 additions & 2 deletions

File tree

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ create or replace package body ut_compound_data_helper is
231231
elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('DATE','TIMESTAMP','TIMESTAMP WITH TIME ZONE',
232232
'TIMESTAMP WITH LOCAL TIME ZONE') then
233233
l_col_type := 'VARCHAR2(50)';
234-
elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('INTERVAL DAY TO SECOND',
235-
'INTERVAL YEAR TO MONTH', 'BINARY_FLOAT', 'BINARY_DOUBLE') then
234+
elsif a_data_info.is_sql_diffable = 1 and type_no_length(a_data_info.column_type) then
236235
l_col_type := a_data_info.column_type;
237236
else
238237
l_col_type := a_data_info.column_type
@@ -570,6 +569,8 @@ create or replace package body ut_compound_data_helper is
570569
--clob/blob/xmltype/object/nestedcursor/nestedtable
571570
if a_type_name IN (g_type_name_map(dbms_sql.blob_type),
572571
g_type_name_map(dbms_sql.clob_type),
572+
g_type_name_map(dbms_sql.long_type),
573+
g_type_name_map(dbms_sql.long_raw_type),
573574
g_type_name_map(dbms_sql.bfile_type),
574575
g_anytype_name_map(dbms_types.typecode_namedcollection))
575576
then
@@ -605,6 +606,16 @@ create or replace package body ut_compound_data_helper is
605606
'Check the query and data for errors.';
606607
end;
607608

609+
function type_no_length ( a_type_name varchar2) return boolean is
610+
begin
611+
return case
612+
when a_type_name in ('INTERVAL DAY TO SECOND','INTERVAL YEAR TO MONTH', 'BINARY_FLOAT', 'BINARY_DOUBLE','ROWID') then
613+
true
614+
else
615+
false
616+
end;
617+
end;
618+
608619
begin
609620
g_anytype_name_map(dbms_types.typecode_date) := 'DATE';
610621
g_anytype_name_map(dbms_types.typecode_number) := 'NUMBER';

source/expectations/data_values/ut_compound_data_helper.pks

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,10 @@ create or replace package ut_compound_data_helper authid definer is
9494

9595
function create_err_cursor_msg(a_error_stack varchar2) return varchar2;
9696

97+
/*
98+
* Function to return true or false if the type dont have an length
99+
*/
100+
function type_no_length ( a_type_name varchar2) return boolean;
101+
97102
end;
98103
/

test/ut3_user/expectations/test_expectations_cursor.pkb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2594,5 +2594,17 @@ Check the query and data for errors.';
25942594
ut.expect(sqlerrm).to_be_like(l_exp_message);
25952595
end;
25962596

2597+
procedure rowid_refcursor is
2598+
l_actual sys_refcursor;
2599+
l_expected sys_refcursor;
2600+
begin
2601+
open l_expected for
2602+
select rowid as test from dual;
2603+
open l_actual for
2604+
select rowid as test from dual;
2605+
2606+
ut3.ut.expect(l_actual).to_equal(l_expected);
2607+
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
2608+
end;
25972609
end;
25982610
/

test/ut3_user/expectations/test_expectations_cursor.pks

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ create or replace package test_expectations_cursor is
405405

406406
--%test(Fail to process a cursor for expected)
407407
procedure xml_error_expected;
408+
409+
--%test(Check that cursor correctly handles ROWID dataype)
410+
procedure rowid_refcursor;
408411

409412
end;
410413
/

0 commit comments

Comments
 (0)