Update ARCHIVE_TABLE_DATA procedure to use GROUP BY instead of DISTINCT to resolve ORA-22950 issue

This commit is contained in:
Grzegorz Michalski
2026-02-09 09:36:05 +01:00
parent 802c102f29
commit 23b9962128

View File

@@ -139,6 +139,7 @@ AS
vTableName := DBMS_ASSERT.SCHEMA_NAME(vSourceFileConfig.ODS_SCHEMA_NAME) || '.'||DBMS_ASSERT.simple_sql_name(vSourceFileConfig.TABLE_ID)||'_ODS'; vTableName := DBMS_ASSERT.SCHEMA_NAME(vSourceFileConfig.ODS_SCHEMA_NAME) || '.'||DBMS_ASSERT.simple_sql_name(vSourceFileConfig.TABLE_ID)||'_ODS';
-- Use strategy-based WHERE clause (MARS-828) -- Use strategy-based WHERE clause (MARS-828)
-- Using GROUP BY instead of DISTINCT to avoid ORA-22950 (object type ordering issue)
vQuery := ' vQuery := '
select t_filename( select t_filename(
file$name file$name
@@ -146,11 +147,11 @@ AS
, to_char(h.workflow_start,''yyyy'') , to_char(h.workflow_start,''yyyy'')
, to_char(h.workflow_start,''mm'') , to_char(h.workflow_start,''mm'')
) )
from '||vTableName||' s from '||vTableName||' s
join CT_MRDS.a_workflow_history h join CT_MRDS.a_workflow_history h
on s.a_workflow_history_key = h.a_workflow_history_key on s.a_workflow_history_key = h.a_workflow_history_key
where ' || GET_ARCHIVAL_WHERE_CLAUSE(vSourceFileConfig) where ' || GET_ARCHIVAL_WHERE_CLAUSE(vSourceFileConfig) || '
group by file$name, file$path, to_char(h.workflow_start,''yyyy''), to_char(h.workflow_start,''mm'')'
; ;
-- Get all files that will be archived into "vfiles" collection ("regular data files") -- Get all files that will be archived into "vfiles" collection ("regular data files")