Database changes

Version 21.1.0

Change type Database Object Description
Add a new function FN_GET_APPTYP_RIGHT_TVF Add a new function FN_GET_APPTYP_RIGHT_TVF
Add a new function FN_GET_INSPTYP_RIGHT_TVF Add a new function FN_GET_INSPTYP_RIGHT_TVF
Drop and add indexes GAUDIT_HISTORY Drop and add indexes on GAUDIT_HISTORY for improving performance
Drop and add indexes GPROCESS_HISTORY Drop and add indexes on GPROCESS_HISTORY for improving performance
Update data RAUDIT_LOG_DEF Update AUDIT_VIEW_ELEMENT_IDS in RAUDIT_LOG_DEF table for OBJ_NAME='InspAuditLogger'
Add a new column GGUIDESHEET_ITEM Add TEAM_NAME column in GGUIDESHEET_ITEM table
Add a new column GGUIDESHEET_ITEM Add FLOOR column in GGUIDESHEET_ITEM table
Add a new column GGUIDESHEET_ITEM Add FLOOR_UNIT column in GGUIDESHEET_ITEM table
Delete the data XRPT_MENU_CRITERIA Delete the data in XRPT_MENU_CRITERIA for RemoveEOLReports
Delete the data XRPT_WORKFLOW Delete the data in XRPT_WORKFLOW for RemoveEOLReports
Delete the data XRPT_PORTLET Delete the data in XRPT_PORTLET for RemoveEOLReports
Delete the data XRPT_RECIPIENT Delete the data in XRPT_RECIPIENT for RemoveEOLReports
Delete the data RPT_PARAMETER_I18N Delete the data in RPT_PARAMETER_I18N for RemoveEOLReports
Delete the data RPT_PARAMETER Delete the data in RPT_PARAMETER for RemoveEOLReports
Delete the data RPT_DOCUMENT Delete the data in RPT_DOCUMENT for RemoveEOLReports
Delete the data RPT_DETAIL_I18N Delete the data in RPT_DETAIL_I18N for RemoveEOLReports
Delete the data RPT_DETAIL Delete the data in RPT_DETAIL for RemoveEOLReports
Delete the data XPOLICY Delete the data in XPOLICY for RemoveEOLReports
Add a new function FN_GET_LOGO Add a new function FN_GET_LOGO
Add new records GVIEW_ELEMENT Add new records to GVIEW_ELEMENT table
Update data GVIEW_ELEMENT Update existing record in GVIEW_ELEMENT table
Update data GVIEW Update existing record in GVIEW table
Add new records GUI_TEXT Add new records to GUI_TEXT table
Add new FID RMENUITEM, AAVERSION_MENUITEM, PPROV_MENUITEM_MODULE Add new FID 8602
Create 21.1.0 FIDs AA_SYS_SEQ, AAVERSION, AAVERSION_MODULE, AAVERSION_MENUITEM, RSERV_PROV, AAVERSION_MENUITEM Create 21.1.0 FIDs for the major release 21.1.0
Create 21.1.0 FIDs for the major release 21.1.0 table_R201 backup tables Drop R20.1 backup tables
Update AA_OBJECTS table AA_OBJECTS Update AA_OBJECTS table to remove old R20.1 backup tables, add new functions and indexes
Update AA_DATA_DIC table AA_DATA_DIC Update AA_DATA_DIC for the new columns

ADS database changes for MSSQL and Oracle

In an MSSQL environment, log into the ADS database and execute the following statements:

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Begin Try
Begin Transaction
IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'EACCESS_LOG_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO EACCESS_LOG_BAK_R2110 FROM EACCESS_LOG;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'EDOC_INDEX_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO EDOC_INDEX_BAK_R2110 FROM EDOC_INDEX;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'EDOC_LOG_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO EDOC_LOG_BAK_R2110 FROM EDOC_LOG;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'EDOC_QUEUE_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO EDOC_QUEUE_BAK_R2110 FROM EDOC_QUEUE;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'EDOCBASE_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO EDOCBASE_BAK_R2110 FROM EDOCBASE;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'ESOAP_LOG_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO ESOAP_LOG_BAK_R2110 FROM ESOAP_LOG;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'RDOC_CONFIG_PROV_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO RDOC_CONFIG_PROV_BAK_R2110 FROM RDOC_CONFIG_PROV;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'RDOC_CONFIG_PROV_PROFILE_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO RDOC_CONFIG_PROV_PROFILE_BAK_R2110 FROM RDOC_CONFIG_PROV_PROFILE;

IF NOT EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME = 'EAUDIT_LOG_BAK_R2110' AND TYPE = 'U')
	SELECT * INTO EAUDIT_LOG_BAK_R2110 FROM EAUDIT_LOG;

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'EACCESS_LOG' AND COLUMN_NAME = 'VCH_SERVPROVCODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[EACCESS_LOG] alter column VCH_SERVPROVCODE varchar(100);';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'EDOC_INDEX' AND COLUMN_NAME = 'SERV_PROV_CODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[EDOC_INDEX] alter column SERV_PROV_CODE varchar(100);';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'EDOC_LOG' AND COLUMN_NAME = 'SERV_PROV_CODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[EDOC_LOG] alter column SERV_PROV_CODE varchar(100);';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'EDOC_QUEUE' AND COLUMN_NAME = 'SERV_PROV_CODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[EDOC_QUEUE] alter column SERV_PROV_CODE varchar(100);';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'EDOCBASE' AND COLUMN_NAME = 'SERV_PROV_CODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[EDOCBASE] alter column SERV_PROV_CODE varchar(100);';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'ESOAP_LOG' AND COLUMN_NAME = 'SERV_PROV_CODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[ESOAP_LOG] alter column SERV_PROV_CODE varchar(100);';

IF EXISTS(select 1 from sys.foreign_keys where name='RDOC_CONFIG_PROV_PROFILE_FK' and parent_object_id=object_id('RDOC_CONFIG_PROV_PROFILE'))
	EXEC SP_EXECUTESQL N'ALTER TABLE [DBO].[RDOC_CONFIG_PROV_PROFILE] DROP CONSTRAINT RDOC_CONFIG_PROV_PROFILE_FK;';

IF EXISTS(select 1 from sys.key_constraints where name='RDOC_CONFIG_PROV_PK' and parent_object_id=object_id('RDOC_CONFIG_PROV'))
	EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[RDOC_CONFIG_PROV] DROP CONSTRAINT [RDOC_CONFIG_PROV_PK];';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'DBO' AND TABLE_NAME = 'RDOC_CONFIG_PROV' AND COLUMN_NAME = 'SERV_PROV_CODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [DBO].[RDOC_CONFIG_PROV] ALTER COLUMN SERV_PROV_CODE VARCHAR(100) NOT NULL;';

IF EXISTS(select 1 from sys.key_constraints where name='RDOC_CONFIG_PROV_PROFILE_PK' and parent_object_id=object_id('RDOC_CONFIG_PROV_PROFILE'))
	EXEC SP_EXECUTESQL N'ALTER TABLE [DBO].[RDOC_CONFIG_PROV_PROFILE] DROP CONSTRAINT [RDOC_CONFIG_PROV_PROFILE_PK];';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'DBO' AND TABLE_NAME = 'RDOC_CONFIG_PROV_PROFILE' AND COLUMN_NAME = 'SERV_PROV_CODE')
	EXEC SP_EXECUTESQL N'ALTER TABLE [DBO].[RDOC_CONFIG_PROV_PROFILE] ALTER COLUMN SERV_PROV_CODE VARCHAR(100) NOT NULL;';

IF NOT EXISTS(select 1 from sys.key_constraints where name='RDOC_CONFIG_PROV_PROFILE_PK' and parent_object_id=object_id('RDOC_CONFIG_PROV_PROFILE'))
EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[RDOC_CONFIG_PROV_PROFILE] ADD  CONSTRAINT [RDOC_CONFIG_PROV_PROFILE_PK] PRIMARY KEY CLUSTERED 
(
	[SERV_PROV_CODE] ASC,
	[PROFILE_NAME] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF,  ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY];';

IF NOT EXISTS(select 1 from sys.key_constraints where name='RDOC_CONFIG_PROV_PK' and parent_object_id=object_id('RDOC_CONFIG_PROV'))
EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[RDOC_CONFIG_PROV] ADD  CONSTRAINT [RDOC_CONFIG_PROV_PK] PRIMARY KEY CLUSTERED 
(
	[SERV_PROV_CODE] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF,  ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY];';

IF NOT EXISTS(select 1 from sys.foreign_keys where name='RDOC_CONFIG_PROV_PROFILE_FK' and parent_object_id=object_id('RDOC_CONFIG_PROV_PROFILE'))
EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[RDOC_CONFIG_PROV_PROFILE]
ADD CONSTRAINT RDOC_CONFIG_PROV_PROFILE_FK
FOREIGN KEY (SERV_PROV_CODE) REFERENCES ADS.dbo.RDOC_CONFIG_PROV (SERV_PROV_CODE);';

IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'DBO' AND TABLE_NAME = 'EAUDIT_LOG' AND COLUMN_NAME = 'SERV_PROV_CODE')
EXEC SP_EXECUTESQL N'ALTER TABLE [dbo].[EAUDIT_LOG] ALTER COLUMN SERV_PROV_CODE VARCHAR(100) not null;';

Commit
End Try
BEGIN CATCH
	SET NOCOUNT ON;
	DECLARE @ErrorMessage NVARCHAR(2048), @ErrorSeverity INT, @ErrorState INT, @ErrorNumber INT, @ErrorLine INT
	SELECT @ErrorMessage=ERROR_MESSAGE(),@ErrorSeverity=ERROR_SEVERITY(),@ErrorState=ERROR_STATE(), @ErrorNumber=ERROR_NUMBER(), @ErrorLine=ERROR_LINE();
	SELECT @ErrorNumber AS ErrorNumber, @ErrorSeverity AS ErrorSeverity, @ErrorState AS ErrorState;
	SELECT @ErrorLine AS ErrorLine, @ErrorMessage AS ErrorMessage; 
	If @@trancount > 0 ROLLBACK
	RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState);
END CATCH;

GO

In an Oracle environment, log into the ADS schema and execute the following statements:

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='EACCESS_LOG_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table EACCESS_LOG_BAK_R2110 as select * from EACCESS_LOG';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='EDOC_INDEX_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table EDOC_INDEX_BAK_R2110 as select * from EDOC_INDEX';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='EDOC_LOG_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table EDOC_LOG_BAK_R2110 as select * from EDOC_LOG';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='EDOC_QUEUE_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table EDOC_QUEUE_BAK_R2110 as select * from EDOC_QUEUE';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='EDOCBASE_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table EDOCBASE_BAK_R2110 as select * from EDOCBASE';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='ESOAP_LOG_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table ESOAP_LOG_BAK_R2110 as select * from ESOAP_LOG';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='EAUDIT_LOG_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table EAUDIT_LOG_BAK_R2110 as select * from EAUDIT_LOG';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='RDOC_CONFIG_PROV_P_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table RDOC_CONFIG_PROV_P_BAK_R2110 as select * from RDOC_CONFIG_PROV_PROFILE';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TABLES where TABLE_NAME='RDOC_CONFIG_PROV_BAK_R2110';
IF (V_COUNT<=0) THEN
EXECUTE IMMEDIATE 'create table RDOC_CONFIG_PROV_BAK_R2110 as select * from RDOC_CONFIG_PROV';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='EACCESS_LOG' and COLUMN_NAME='VCH_SERVPROVCODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE EACCESS_LOG MODIFY VCH_SERVPROVCODE varchar2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='EDOC_INDEX' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE EDOC_INDEX MODIFY SERV_PROV_CODE varchar2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='EDOC_LOG' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE EDOC_LOG MODIFY SERV_PROV_CODE varchar2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='EDOC_QUEUE' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE EDOC_QUEUE MODIFY SERV_PROV_CODE varchar2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='EDOCBASE' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE EDOCBASE MODIFY SERV_PROV_CODE varchar2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='ESOAP_LOG' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE ESOAP_LOG MODIFY SERV_PROV_CODE varchar2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='EAUDIT_LOG' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE EAUDIT_LOG MODIFY SERV_PROV_CODE varchar2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_CONSTRAINTS where CONSTRAINT_NAME='RDOC_CONFIG_PROV_PROFILE_FK';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'alter table RDOC_CONFIG_PROV_PROFILE drop constraint RDOC_CONFIG_PROV_PROFILE_FK';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_CONSTRAINTS where CONSTRAINT_NAME='RDOC_CONFIG_PROV_PK';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'alter table RDOC_CONFIG_PROV drop constraint RDOC_CONFIG_PROV_PK';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='RDOC_CONFIG_PROV' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE RDOC_CONFIG_PROV MODIFY serv_prov_code VARCHAR2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_CONSTRAINTS where CONSTRAINT_NAME='RDOC_CONFIG_PROV_PROFILE_PK';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'alter table RDOC_CONFIG_PROV_PROFILE drop constraint RDOC_CONFIG_PROV_PROFILE_PK';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_TAB_COLUMNS where TABLE_NAME='RDOC_CONFIG_PROV_PROFILE' and COLUMN_NAME='SERV_PROV_CODE';
IF (V_COUNT=1) THEN
EXECUTE IMMEDIATE 'ALTER TABLE RDOC_CONFIG_PROV_PROFILE MODIFY serv_prov_code VARCHAR2(100)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_CONSTRAINTS where CONSTRAINT_NAME='RDOC_CONFIG_PROV_PK';
IF (V_COUNT=0) THEN
EXECUTE IMMEDIATE 'ALTER TABLE RDOC_CONFIG_PROV ADD CONSTRAINT RDOC_CONFIG_PROV_PK PRIMARY KEY (SERV_PROV_CODE)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_CONSTRAINTS where CONSTRAINT_NAME='RDOC_CONFIG_PROV_PROFILE_PK';
IF (V_COUNT=0) THEN
EXECUTE IMMEDIATE 'ALTER TABLE RDOC_CONFIG_PROV_PROFILE ADD CONSTRAINT RDOC_CONFIG_PROV_PROFILE_PK PRIMARY KEY (SERV_PROV_CODE, PROFILE_NAME)';      
END IF;
END;
/

DECLARE
V_COUNT  NUMBER;
BEGIN
select count(*) into V_COUNT from USER_CONSTRAINTS where CONSTRAINT_NAME='RDOC_CONFIG_PROV_PROFILE_PK';
IF (V_COUNT=0) THEN
EXECUTE IMMEDIATE 'ALTER TABLE RDOC_CONFIG_PROV_PROFILE ADD CONSTRAINT RDOC_CONFIG_PROV_PROFILE_FK FOREIGN KEY (SERV_PROV_CODE) REFERENCES ADS.RDOC_CONFIG_PROV (SERV_PROV_CODE) ENABLE';      
END IF;
END;
/

COMMIT;