Tascha Application


Package tascha_pkg

Package used to create/maintain/schedule tasks.


Method Summary
 add_task_prm(i_sched_id NUMBER, i_prm_name VARCHAR2, i_prm_value VARCHAR2)
           Adds parameters to a task already scheduled using schedule_task.
 create_task(i_procedure_name VARCHAR2, i_category VARCHAR2 DEFAULT NULL, i_title VARCHAR2 DEFAULT NULL, i_full_desc VARCHAR2 DEFAULT NULL, i_sql_trace BOOLEAN DEFAULT FALSE, i_success_email VARCHAR2 DEFAULT NULL, i_failure_email VARCHAR2 DEFAULT NULL, o_task_id OUT NUMBER)
           Used to create a task ready for scheduling later.
 disable_task(i_sched_id NUMBER)
           Disables a scheduled task Does NOT commit.
 enable_task(i_sched_id NUMBER)
           Enables a scheduled task Does NOT commit.
 reschedule_task(i_sched_id NUMBER, i_hour VARCHAR2 DEFAULT NULL, i_min VARCHAR2 DEFAULT NULL, i_dom NUMBER DEFAULT NULL, i_month NUMBER DEFAULT NULL, i_dow VARCHAR2 DEFAULT NULL, i_dow_first BOOLEAN DEFAULT FALSE, i_dow_last BOOLEAN DEFAULT FALSE, i_once_only BOOLEAN DEFAULT FALSE, i_enabled BOOLEAN DEFAULT TRUE)
           Reschedules a scheduled task Does NOT commit.
 reset_scheduler()
           Stops the task scheduler if it's running and resets the scheduler so it is sure it isn't running.
 schedule_task(i_task_id NUMBER, i_hour VARCHAR2 DEFAULT NULL, i_min VARCHAR2 DEFAULT NULL, i_dom NUMBER DEFAULT NULL, i_month NUMBER DEFAULT NULL, i_dow VARCHAR2 DEFAULT NULL, i_dow_first BOOLEAN DEFAULT FALSE, i_dow_last BOOLEAN DEFAULT FALSE, i_once_only BOOLEAN DEFAULT FALSE, i_enabled BOOLEAN DEFAULT TRUE, o_sched_id OUT NUMBER)
           Schedules a task already created using create_task.
 start_scheduler()
           Starts the task scheduler which wakes up every minute and checks for any jobs scheduled for that minute.
 stop_scheduler()
           Stops the task scheduler
 task_log_maint(i_older_than DATE DEFAULT NULL)
           Used to maintain the task_logs table.

Method Detail

create_task

  public  create_task(i_procedure_name VARCHAR2, 
i_category VARCHAR2 DEFAULT NULL,
i_title VARCHAR2 DEFAULT NULL,
i_full_desc VARCHAR2 DEFAULT NULL,
i_sql_trace BOOLEAN DEFAULT FALSE,
i_success_email VARCHAR2 DEFAULT NULL,
i_failure_email VARCHAR2 DEFAULT NULL,
o_task_id OUT NUMBER)
Used to create a task ready for scheduling later. One task can therefore be run across multiple schedule entries for flexibility. Does NOT commit.
Parameters:
i_procedure_name - Name of procedure to be executed
i_category - Option category of task. Used purely for reporting/maintenance.
i_title - Task title
i_full_desc - Full task description. Used purely for your info.
i_sql_trace - Run the job with sql_trace enabled (true/false).
i_success_email - Shortcut to call of add_task_email
i_failure_email - Shortcut to call of add_task_email
o_task_id - ID of newly created task

schedule_task

  public  schedule_task(i_task_id NUMBER, 
i_hour VARCHAR2 DEFAULT NULL,
i_min VARCHAR2 DEFAULT NULL,
i_dom NUMBER DEFAULT NULL,
i_month NUMBER DEFAULT NULL,
i_dow VARCHAR2 DEFAULT NULL,
i_dow_first BOOLEAN DEFAULT FALSE,
i_dow_last BOOLEAN DEFAULT FALSE,
i_once_only BOOLEAN DEFAULT FALSE,
i_enabled BOOLEAN DEFAULT TRUE,
o_sched_id OUT NUMBER)
Schedules a task already created using create_task. Does NOT commit.
Parameters:
i_task_id - ID of task being scheduled
i_hour - Option hours of day to run task. Allows comma separated values. e.g "8,12,17" for 8am, 12pm and 5pm.
i_min - Optional minute of current hour to run task. Allows comma seperated values. e.g "0,15,30,45" to run every 15 mins
i_dom - Optional day of month to run task. e.g. "1" for 1st of month
i_month - Optional month to run task. e.g. "1" for January
i_dow - Optional day of week to run task. e.g. "1,3" to run task on Mondays and Wednesdays
i_dow_first - True if dow value is to only apply to first occurence in month. Optional.
i_dow_last - True if dow value is to only apply to last occurence in month. Optional.
i_once_only - True to make job disable itself after 1st run. Optional.
i_enabled - False to schedule job but not activate it.
o_sched_id - ID of newly scheduled task

reschedule_task

  public  reschedule_task(i_sched_id NUMBER, 
i_hour VARCHAR2 DEFAULT NULL,
i_min VARCHAR2 DEFAULT NULL,
i_dom NUMBER DEFAULT NULL,
i_month NUMBER DEFAULT NULL,
i_dow VARCHAR2 DEFAULT NULL,
i_dow_first BOOLEAN DEFAULT FALSE,
i_dow_last BOOLEAN DEFAULT FALSE,
i_once_only BOOLEAN DEFAULT FALSE,
i_enabled BOOLEAN DEFAULT TRUE)
Reschedules a scheduled task Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task
i_hour - Option hours of day to run task. Allows comma separated values. e.g "8,12,17" for 8am, 12pm and 5pm.
i_min - Optional minute of current hour to run task. Allows comma seperated values. e.g "0,15,30,45" to run every 15 mins
i_dom - Optional day of month to run task. e.g. "1" for 1st of month
i_month - Optional month to run task. e.g. "1" for January
i_dow - Optional day of week to run task. e.g. "1,3" to run task on Mondays and Wednesdays
i_dow_first - True if dow value is to only apply to first occurence in month. Optional.
i_dow_last - True if dow value is to only apply to last occurence in month. Optional.
i_once_only - True to make job disable itself after 1st run. Optional.
i_enabled - False to schedule job but not activate it.

enable_task

  public  enable_task(i_sched_id NUMBER)
Enables a scheduled task Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task

disable_task

  public  disable_task(i_sched_id NUMBER)
Disables a scheduled task Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task

add_task_prm

  public  add_task_prm(i_sched_id NUMBER, 
i_prm_name VARCHAR2,
i_prm_value VARCHAR2)
Adds parameters to a task already scheduled using schedule_task. Done on scheduled tasks rather than unscheduled ones as different inputs may be required for different schedules. Specifically doesn't validate datatypes as procedure may be subject to change, datatypes are checked at runtime. Does NOT commit.
Parameters:
i_sched_id - ID of scheduled task
i_prm_name - Name of input parameter to procedure specified in create_task.
i_prm_value - Value of input parameter

start_scheduler

  public  start_scheduler()
Starts the task scheduler which wakes up every minute and checks for any jobs scheduled for that minute.
Throws:
sched_already_started -

stop_scheduler

  public  stop_scheduler()
Stops the task scheduler
Throws:
sched_already_stopped -

reset_scheduler

  public  reset_scheduler()
Stops the task scheduler if it's running and resets the scheduler so it is sure it isn't running. Just incase things get out of step with each other

task_log_maint

  public  task_log_maint(i_older_than DATE DEFAULT NULL)
Used to maintain the task_logs table.
Parameters:
i_older_than - If NULL then defaults to today-30.

Tascha Application