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

Skip to content

Commit 0fc68d1

Browse files
committed
Update order by to be done before max row nums are pulled
1 parent 8a33c25 commit 0fc68d1

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

source/expectations/data_values/ut_compound_data_diff_tmp.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ create global temporary table ut_compound_data_diff_tmp(
1616
item_no integer,
1717
item_hash raw(128),
1818
duplicate_no integer,
19-
--constraint ut_compound_data_diff_tmp_uk1 unique (diff_id, item_no, item_hash, duplicate_no),
19+
constraint ut_compound_data_diff_tmp_uk1 unique (diff_id, item_no, item_hash, duplicate_no),
2020
constraint ut_compound_data_diff_tmp_chk check(
2121
item_no is not null and item_hash is null and duplicate_no is null
2222
or item_no is null and item_hash is not null and duplicate_no is not null

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ create or replace package body ut_compound_data_helper is
178178
execute immediate q'[
179179
with diff_info as (select item_hash from ut_compound_data_diff_tmp ucdc where diff_id = :diff_guid)
180180
select rn,diff_type,diffed_row
181+
from
182+
(
183+
select rn,diff_type,diffed_row
181184
from
182185
(select dense_rank() over (order by pk_hash) as rn, diff_type,data_item diffed_row
183186
from
@@ -231,8 +234,10 @@ create or replace package body ut_compound_data_helper is
231234
unpivot ( data_item for diff_type in (exp_item as 'Expected:', act_item as 'Actual:'
232235
,miss_item as 'Missing:', ext_item as 'Extra:') )
233236
)
237+
order by 1, 2
238+
)
234239
where rownum <= :max_rows
235-
order by 1, 2]'
240+
]'
236241
bulk collect into l_results
237242
using a_diff_id,
238243
a_join_by_xpath,a_exclude_xpath, a_include_xpath, a_expected_dataset_guid,

source/expectations/data_values/ut_compound_data_tmp.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ create global temporary table ut_compound_data_tmp(
1616
item_no integer,
1717
item_data xmltype,
1818
item_hash raw(128),
19-
duplicate_no integer
20-
--constraint ut_cmp_data_tmp_item_ak unique (data_id, item_no),
21-
--constraint ut_cmp_data_tmp_hash_pk unique (data_id, item_hash , duplicate_no)
19+
duplicate_no integer,
20+
constraint ut_cmp_data_tmp_hash_pk unique (data_id,item_no, item_hash , duplicate_no)
2221
) on commit preserve rows;

0 commit comments

Comments
 (0)