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

INSERT INTO CI_BATCH_CTRL_P (BATCH_CD,SEQ_NUM,BATCH_PARM_NAME,BATCH_PARM_VAL,REQUIRED_SW,OWNER_FLG,TEXT_SECURITY_FLG) SELECT BC.BATCH_CD,NVL2((SELECT BCP.BATCH_CD FROM CI_BATCH_CTRL_P BCP WHERE BCP.BATCH_CD = BC.BATCH_CD AND BCP.SEQ_NUM =80),81,80) AS SEQ_NUM ,'doNotApplyRedactRules',' ','N',BC.OWNER_FLG,' ' FROM CI_BATCH_CTRL BC WHERE TRIM(BC.PROGRAM_NAME) = 'com.splwg.base.domain.dataExport.initialExportBatch.InitialExportBatchProcess' AND NOT EXISTS (SELECT 'X' FROM CI_BATCH_CTRL_P BCP WHERE BCP.BATCH_CD = BC.BATCH_CD AND BCP.BATCH_PARM_NAME = 'doNotApplyRedactRules')
/

INSERT INTO CI_BATCH_CTRL_P_L (BATCH_CD, SEQ_NUM, LANGUAGE_CD, DESCR50, DESCRLONG, VERSION, OWNER_FLG) SELECT BCP.BATCH_CD, BCP.SEQ_NUM, 'ENG', tmplvw.DESCR50, tmplvw.DESCRLONG, 1, BCP.OWNER_FLG FROM CI_BATCH_CTRL_P BCP, (select DESCR50, DESCRLONG from CI_BATCH_CTRL_P TMPL, CI_BATCH_CTRL_P_L TMPLL  where TMPL.BATCH_CD = 'F1-GEIXP' and TMPL.BATCH_PARM_NAME = 'doNotApplyRedactRules' and TMPL.BATCH_CD = TMPLL.BATCH_CD and TMPL.SEQ_NUM = TMPLL.SEQ_NUM and TMPLL.LANGUAGE_CD = 'ENG') tmplvw WHERE BCP.BATCH_PARM_NAME = 'doNotApplyRedactRules' AND NOT EXISTS (SELECT 'X' FROM CI_BATCH_CTRL_P_L BCPL WHERE BCPL.LANGUAGE_CD = 'ENG' AND BCPL.BATCH_CD = BCP.BATCH_CD AND BCPL.SEQ_NUM = BCP.SEQ_NUM)
/