본문 바로가기

wif LiNoUz/DATASTAGE

작업 스케줄러 routine 매 5분 마다 1번씩!

작업 스케줄러에서 (매 5분마다 실행되게하는 루틴)


------------------------------------------------------------------------------------

xxxx. bat

------------------------------------------------------------------------------------


@echo off 

set connect_info=USERID/USERPASSWD@PEDWDB

set sql=sqlplus -s %connect_info% @D:\sw\IBM\EDW_Batch\edw_bat_check.sql

set file=D:\sw\IBM\EDW_Batch\Success.txt

FOR /F "usebackq" %%i IN (`%sql%`) DO set x=%%i 

echo %x%

if %x%==Y (type NUL>%file%)



------------------------------------------------------------------------------------





============================================================================================

============================================================================================




------------------------------------------------------------------------------------

xxx.sql

------------------------------------------------------------------------------------


set serveroutput on

set feedback off


DECLARE

    pBASE_DT       VARCHAR2(8);

 pYN            VARCHAR2(10);

BEGIN


 SELECT TO_CHAR(SYSDATE - 1, 'YYYYMMDD') 

 INTO pBASE_DT

 FROM DUAL;


    SELECT BASE_DT||ACNT_CMPL_YN||FILE_TRNM_YN

      INTO pYN

      FROM TODCMJOBPRMNGL

     WHERE BASE_DT = pBASE_DT;

     

     IF pYN = pBASE_DT||'Y'||'N' 

     THEN 

          DBMS_OUTPUT.PUT_LINE('Y');

     ELSE DBMS_OUTPUT.PUT_LINE('N');

     END IF;

     

END;

/


exit


------------------------------------------------------------------------------------