PROMPT Pokrenuta skripta enable_jobs.sql

set serveroutput on;

BEGIN
  DBMS_OUTPUT.PUT_LINE ('----- popis aktiviranih jobova -----');
  FOR enable_c IN (
    SELECT job_name
      FROM user_scheduler_jobs
     WHERE enabled = 'FALSE'
       AND TO_DATE (TO_CHAR (NEXT_RUN_DATE, 'DD.MM.RRRR HH24:MI:SS'), 'DD.MM.RRRR HH24:MI:SS') > SYSDATE - 1 / 6
       AND (   job_name LIKE '%DNEVNI_IZV_PONAVLJANJE'
            OR job_name LIKE '%STANJE_BOOKINGA'
            OR job_name LIKE '%IZMJENE_BOOK_I_OVERBOOK'
            OR job_name LIKE '%GET_USL_RAO'
            OR job_name LIKE '%ROOMCLOUD_REZ'
            OR job_name LIKE '%REZVANJSUS'
            OR job_name LIKE '%EVISITOR')
    )
  LOOP
    DBMS_OUTPUT.PUT_LINE (enable_c.job_name);
    DBMS_SCHEDULER.ENABLE (enable_c.job_name);
  END LOOP;
END;
/
