job_set_ndxsys.sql - will setup the package as job 12 at 21:00 hours today

set echo off;

clear screen;

PROMPT

PROMPT COLLECTING USER INFORMATION
PROMPT

ACCEPT database_sid CHAR PROMPT 'DATABASE TO CONNECT TO [ORCL]: ' DEFAULT ORCL
ACCEPT mhsys_password CHAR PROMPT 'PASSWORD FOR USER MHSYS [MHSYS]: ' DEFAULT MHSYS HIDE
PROMPT

prompt CONNECTING USER MHSYS
connect MHSYS/&mhsys_password@&database_sid;

set serveroutput on;
set linesize 100;
spool job_set_ndxsys.log;

prompt SHOWING JOBS
select JOB, SCHEMA_USER,
to_char(NEXT_DATE, 'DD-MON-YYYY, HH24:MI') NEXT_DATE,
INTERVAL, WHAT
from dba_jobs

order by job;

prompt DELETING JOBS
delete from DBA_JOBS
where job IN (12);
commit;

prompt CREATING JOBS
begin
DBMS_JOB.ISUBMIT
(job => 12,
what => 'PKG_NDXSYS.P_MAIN;',
next_date => trunc(sysdate) + 19/24 + 00/1440,
interval => 'sysdate + 1',
no_parse => FALSE);
commit;
end;
/

prompt SHOWING JOBS
select name DATABASE from v$database;
select JOB, SCHEMA_USER,
to_char(NEXT_DATE, 'DD-MON-YYYY, HH24:MI') NEXT_DATE,
INTERVAL, WHAT
from dba_jobs
order by job;

spool off;