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

ReleaseYes/No
8.3.x

Applicable RDBMS

RDBMSYes/No
CSS4
CSS3

Query for JAVA (CSS, Oracle, SQL Server)

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