__IF_EXISTS__
SELECT 1
  FROM CI_UT_INSTL_DTL
 WHERE SCRIPT_FILE_NAME = 'FW410_APDATA30.SQL'
   AND END_DTTM IS NOT NULL
/
__THEN__

__EXIT__

__ENDIF__


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

__EXIT__

__ENDIF__


UPDATE F1_BUS_OBJ SET INSTANCE_CTRL_FLG = 'F1NA' WHERE BUS_OBJ_CD = 'F1-ExtLkpPhysicalBO'
/

update F1_EXTSYS_OUTMSG_PROF set DTTM_FORMAT_FLG = 'F1OU' where rtrim(DTTM_FORMAT_FLG) IS NULL 
/


UPDATE CI_CHAR_TYPE SET CUSTOM_SW = 'N' WHERE RTRIM(CUSTOM_SW) IS NULL 
/ 


UPDATE CI_MD_MO SET PROG_COM_ID = 'CIPYPGDJ' WHERE RTRIM(PROG_COM_ID) IS NULL 
/ 

UPDATE F1_BUS_OBJ_STATUS
SET SORT_SEQ5 = 0,
    BO_STATUS_COND_FLG = ' ',
    ACCESS_MODE = ' ',
    BATCH_CD = ' ',
    BO_ALERT_FLG = ' ',
    BO_TRANSITORY_FLG = ' '
WHERE BUS_OBJ_CD IN (SELECT BUS_OBJ_CD FROM F1_BUS_OBJ WHERE RTRIM(PARENT_BO_CD) IS NOT NULL AND UPPER(bus_obj_cd) NOT LIKE 'ZZ%' )
/


UPDATE F1_BUS_OBJ_STATUS_L
SET DESCR = ' ',
    DESCR254 = ' ',
    DESCRLONG = ' '
WHERE BUS_OBJ_CD IN (SELECT BUS_OBJ_CD FROM F1_BUS_OBJ WHERE RTRIM(PARENT_BO_CD) IS NOT NULL AND UPPER(bus_obj_cd) NOT LIKE 'ZZ%' )
/

UPDATE CI_FK_REF SET ZONE_CD = 'F1-BOMOSRC' WHERE FK_REF_CD = 'C1-BOMO' 
/


UPDATE CI_FK_REF SET ZONE_CD = 'F1-OUTMSGTYS' WHERE FK_REF_CD = 'F1-OMTYP'
/ 


UPDATE CI_FK_REF SET ZONE_CD = 'F1-OUTMSGTYS' WHERE FK_REF_CD = 'F1-OMTYP'
/ 


DELETE FROM f1_db_objects_repo WHERE db_object_name IN ('XT039S6','F1C735S1')
/


INSERT INTO F1_DB_OBJECTS_REPO (DB_OBJECT_NAME,SEQNO,OBJECT_TYPE,TBL_NAME,INDEXED_COLUMN,VERSION,OWNER_FLG) SELECT 'XC691S1',1,'INDEX','CI_DAR_USR','USER_ID',1,'F1'  FROM F1_INSTALLATION WHERE NOT EXISTS (SELECT 1 FROM F1_DB_OBJECTS_REPO WHERE DB_OBJECT_NAME = 'XC691S1' AND SEQNO = 1  AND OWNER_FLG = 'F1' ) 
/
INSERT INTO F1_DB_OBJECTS_REPO (DB_OBJECT_NAME,SEQNO,OBJECT_TYPE,TBL_NAME,INDEXED_COLUMN,VERSION,OWNER_FLG) SELECT 'XC691S1',2,'INDEX','CI_DAR_USR','DAR_CD',1,'F1'  FROM F1_INSTALLATION WHERE NOT EXISTS (SELECT 1 FROM F1_DB_OBJECTS_REPO WHERE DB_OBJECT_NAME = 'XC691S1' AND SEQNO = 2  AND OWNER_FLG = 'F1' ) 
/
INSERT INTO F1_DB_OBJECTS_REPO (DB_OBJECT_NAME,SEQNO,OBJECT_TYPE,TBL_NAME,INDEXED_COLUMN,VERSION,OWNER_FLG) SELECT 'XC691S1',3,'INDEX','CI_DAR_USR','EXPIRE_DT',1,'F1'  FROM F1_INSTALLATION WHERE NOT EXISTS (SELECT 1 FROM F1_DB_OBJECTS_REPO WHERE DB_OBJECT_NAME = 'XC691S1' AND SEQNO = 3  AND OWNER_FLG = 'F1' ) 
/
