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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding ROWID to list of types that do not provide a length.
  • Loading branch information
lwasylow committed Apr 8, 2019
commit 80a46d0a903b453c64afae73f51de7ecc26f3a3e
15 changes: 13 additions & 2 deletions source/expectations/data_values/ut_compound_data_helper.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ create or replace package body ut_compound_data_helper is
elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('DATE','TIMESTAMP','TIMESTAMP WITH TIME ZONE',
'TIMESTAMP WITH LOCAL TIME ZONE') then
l_col_type := 'VARCHAR2(50)';
elsif a_data_info.is_sql_diffable = 1 and a_data_info.column_type in ('INTERVAL DAY TO SECOND',
'INTERVAL YEAR TO MONTH', 'BINARY_FLOAT', 'BINARY_DOUBLE') then
elsif a_data_info.is_sql_diffable = 1 and type_no_length(a_data_info.column_type) then
l_col_type := a_data_info.column_type;
else
l_col_type := a_data_info.column_type
Expand Down Expand Up @@ -570,6 +569,8 @@ create or replace package body ut_compound_data_helper is
--clob/blob/xmltype/object/nestedcursor/nestedtable
if a_type_name IN (g_type_name_map(dbms_sql.blob_type),
g_type_name_map(dbms_sql.clob_type),
g_type_name_map(dbms_sql.long_type),
g_type_name_map(dbms_sql.long_raw_type),
g_type_name_map(dbms_sql.bfile_type),
g_anytype_name_map(dbms_types.typecode_namedcollection))
then
Expand Down Expand Up @@ -605,6 +606,16 @@ create or replace package body ut_compound_data_helper is
'Check the query and data for errors.';
end;

function type_no_length ( a_type_name varchar2) return boolean is
begin
return case
when a_type_name in ('INTERVAL DAY TO SECOND','INTERVAL YEAR TO MONTH', 'BINARY_FLOAT', 'BINARY_DOUBLE','ROWID') then
true
else
false
end;
end;

begin
g_anytype_name_map(dbms_types.typecode_date) := 'DATE';
g_anytype_name_map(dbms_types.typecode_number) := 'NUMBER';
Expand Down
5 changes: 5 additions & 0 deletions source/expectations/data_values/ut_compound_data_helper.pks
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,10 @@ create or replace package ut_compound_data_helper authid definer is

function create_err_cursor_msg(a_error_stack varchar2) return varchar2;

/*
* Function to return true or false if the type dont have an length
*/
function type_no_length ( a_type_name varchar2) return boolean;

end;
/
12 changes: 12 additions & 0 deletions test/ut3_user/expectations/test_expectations_cursor.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -2594,5 +2594,17 @@ Check the query and data for errors.';
ut.expect(sqlerrm).to_be_like(l_exp_message);
end;

procedure rowid_refcursor is
l_actual sys_refcursor;
l_expected sys_refcursor;
begin
open l_expected for
select rowid as test from dual;
open l_actual for
select rowid as test from dual;

ut3.ut.expect(l_actual).to_equal(l_expected);
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
end;
end;
/
3 changes: 3 additions & 0 deletions test/ut3_user/expectations/test_expectations_cursor.pks
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ create or replace package test_expectations_cursor is

--%test(Fail to process a cursor for expected)
procedure xml_error_expected;

--%test(Check that cursor correctly handles ROWID dataype)
procedure rowid_refcursor;

end;
/