__IF_EXISTS__
SELECT 1
  FROM CI_UT_INSTL_DTL
WHERE SCRIPT_FILE_NAME = 'FW44022_POSTDATA_UGBUPD-5949.SQL'
   AND END_DTTM IS NOT NULL
/
__THEN__
__EXIT__
__ENDIF__

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1ALGQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILTALGP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1ALGQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1ALGQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILTALGP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1ALGQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1BSVQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'FWLTBSVP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1BSVQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1BSVQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='FWLTBSVP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1BSVQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1DTARQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'FWLTDARP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1DTARQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1DTARQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='FWLTDARP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1DTARQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1FCFGQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILTWSDP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1FCFGQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1FCFGQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILTWSDP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1FCFGQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1FKRFQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILEFKRP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1FKRFQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1FKRFQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILEFKRP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1FKRFQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1MANCQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'FWLTMGCT' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1MANCQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1MANCQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='FWLTMGCT' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1MANCQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1MENUQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILEMNUP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1MENUQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1MENUQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILEMNUP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1MENUQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1MOQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILEMOBP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1MOQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1MOQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILEMOBP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1MOQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1NAVKQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILENAVP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1NAVKQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1NAVKQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILENAVP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1NAVKQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1NAVOQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILENVOP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1NAVOQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1NAVOQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILENVOP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1NAVOQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1PRTLQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILZPORP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1PRTLQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1PRTLQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILZPORP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1PRTLQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1TBLQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILETBLP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1TBLQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1TBLQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILETBLP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1TBLQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1UIMPQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'FWLTUIMP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1UIMPQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1UIMPQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='FWLTUIMP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1UIMPQ' and B.Access_Mode='R')
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1ZONEQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILZZONP' and Not Exists(Select 1 From sc_usr_grp_prof B Where B.USR_GRP_ID=A.USR_GRP_ID And B.App_Svc_ID='F1ZONEQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1ZONEQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILZZONP' And A.Access_Mode = 'R' And Not Exists(Select 1 From Sc_Access_Cntl B Where B.Usr_Grp_ID=A.Usr_Grp_ID and B.App_Svc_ID='F1ZONEQ' and B.Access_Mode='R')
/

Update ci_fk_ref set zone_cd = 'F1-MOSRCH' where fk_ref_cd = 'F1-MO' and zone_cd = ' '
/

Update ci_fk_ref set zone_cd = 'F1-TBLSRCH' where fk_ref_cd = 'TABLE' and zone_cd = ' '
/

Update ci_fk_ref set zone_cd = 'F1NAVKQS' where fk_ref_cd = 'F1-NAVK' and zone_cd = ' '
/
