__IF_EXISTS__
SELECT 1
  FROM CI_INSTALL_PROD
 WHERE INSTALL_OPT_ID = '11111'
   AND OWNER_FLG = 'F1'
/
__ELSE__

__EXIT__

__ENDIF__


UPDATE CI_PORTAL SET USER_CONFIG_FLG = 'Y' WHERE RTRIM(USER_CONFIG_FLG) IS NULL
/

UPDATE F1_BUS_SVC SET APP_SVC_ID = 'F1-DFLTAPS' WHERE RTRIM(APP_SVC_ID) IS NULL
/

UPDATE CI_SCR
   SET APP_SVC_ID = 'F1-DFLTAPS'
 WHERE RTRIM(APP_SVC_ID) IS NULL AND SCR_TYPE_FLG = 'SVSC'
/

INSERT INTO SC_USR_GRP_PROF
(USR_GRP_ID, APP_SVC_ID, EXPIRATION_DT , VERSION ,OWNER_FLG )
SELECT B.USR_GRP_ID, 'F1-DFLTAPS', '01-JAN-2100', 1, B.OWNER_FLG
FROM SC_USER_GROUP B
WHERE NOT EXISTS ( SELECT 1 FROM SC_USR_GRP_PROF C
                    WHERE C.USR_GRP_ID  = B.USR_GRP_ID
                      AND C.APP_SVC_ID  = 'F1-DFLTAPS'
                 ) 
/

INSERT INTO SC_ACCESS_CNTL
(USR_GRP_ID, APP_SVC_ID, ACCESS_MODE, VERSION ,OWNER_FLG )
SELECT B.USR_GRP_ID, 'F1-DFLTAPS', 'F1EX', 1,  B.OWNER_FLG
from SC_USER_GROUP B
WHERE NOT EXISTS ( SELECT 1 FROM SC_ACCESS_CNTL C
                    WHERE C.USR_GRP_ID  = B.USR_GRP_ID
                      AND C.APP_SVC_ID  = 'F1-DFLTAPS'
                      AND C.ACCESS_MODE = 'F1EX'
                 ) 
/


UPDATE SC_USER SET USER_ENABLE_FLG = 'ENBL' WHERE RTRIM(USER_ENABLE_FLG) IS NULL
/

