__IF_EXISTS__
SELECT 1
  FROM CI_UT_INSTL_DTL
WHERE SCRIPT_FILE_NAME = 'FW44021_POSTDATA_UGBUPD-5720.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,'F1FLDQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILEFLDP' 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='F1FLDQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1FLDQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILEFLDP' 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='F1FLDQ' 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,'F1CHRTYQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILTCHTP' 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='F1CHRTYQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1CHRTYQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILTCHTP' 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='F1CHRTYQ' and B.Access_Mode='R')
/

Update ci_fk_ref set zone_cd = 'F1-CHTYPQ' where fk_ref_cd = 'CHAR_TYP' and zone_cd = ' '
/

Insert into sc_usr_grp_prof (USR_GRP_ID,APP_SVC_ID,EXPIRATION_DT,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1BTCHQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILTBTCP' 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='F1BTCHQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1BTCHQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILTBTCP' 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='F1BTCHQ' 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,'F1BOQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'FWLTBOJP' 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='F1BOQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1BOQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='FWLTBOJP' 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='F1BOQ' 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,'F1LKUPQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILTLKFP' 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='F1LKUPQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1LKUPQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILTLKFP' 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='F1LKUPQ' 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,'F1SCRQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILZSCRP' 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='F1SCRQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1SCRQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILZSCRP' 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='F1SCRQ' 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,'F1ALGTQ',EXPIRATION_DT,1,OWNER_FLG From sc_usr_grp_prof A Where A.App_Svc_Id = 'CILTALTP' 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='F1ALGTQ')
/

Insert into sc_access_cntl (USR_GRP_ID,APP_SVC_ID,ACCESS_MODE,VERSION,OWNER_FLG) Select USR_GRP_ID,'F1ALGTQ','R',1,OWNER_FLG From SC_Access_CNTL A Where A.App_Svc_ID='CILTALTP' 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='F1ALGTQ' and B.Access_Mode='R')
/

Update ci_fk_ref set zone_cd = 'F1-ALGTYPQ' where fk_ref_cd = 'F1-ALGTY' and zone_cd = ' '
/
