SQL Queries - CAST Management Base - Assign the analysis unit to respective analysis unit module

Purpose of Query

This query when run on the CAST management base will make sure that the analysis units are tagged to their respective modules

Applicable CAST Version
Release
Yes/No
8.3.x(tick)
Applicable RDBMS
RDBMS
Yes/No
CSS4(tick)
CSS3(tick)
Query for JAVA (CSS, Oracle, SQL Server)
How to check for overlapping analysis units (here it is JAVA case)
insert into CMS_ObjectLinks (Caller_Id, Callee_Id, Symbol, Position)
select cpof.Object_Id,
       min(mau.Object_Id),
       'analysisunits',
       0
  from CMS_PORTF_Module cpm
  join CMS_PORTF_ObjectFilter cpof
    on cpof.Module_Id = cpm.Object_Id
  join MAINT_AnalysisUnits mau
    on mau.Object_Name = cpm.Object_Name
   and mau.Active = 1
  where not exists (select 1
                      from CMS_ObjectLinks col
                     where col.Caller_Id = cpof.Object_Id
                       and col.Symbol = 'analysisunits'
                   )
 group by cpof.Object_Id;
Query result example

Query result interpretation
 Any analysis unit not tagged to the corresponding module based on AU will be referenced correctly with the AU. 
Notes/comments

Ticket # 33484