PL/SQL Documentation task

The procedures and functions needed for creating and changing scheduler tasks are located in the SO_TASK package.
These procedures are the same used by the scheduler client.
Every option available in the scheduler client is also available in PL/SQL and vice versa.

Back to top 

Creating tasks

If for a scheduler script the property create procedure is set a task can be created using the PL/SQL procedure with the same name as the script.

Example 1

If a predefined script procedure LINESSCRIPT exists for which the property create procedure is set the following command will create a task with a default schedule (it will run once and is scheduled now).

SQL> exec linesscript(p_lines => 50);

PL/SQL procedure successfully completed.

SQL> exec so_task.committasks;

PL/SQL procedure successfully completed.
  

The procedure SO_TASK.COMMITTASKS is used because beside a commit it triggers the scheduler server.
If instead a regular commit is used the task is still created but the scheduler server is not triggered so it could take some time for the task to be activated.

If a scheduler script is defined for which the property create procedure is not set a task can only be created with the next procedures.

These procedures can be used for any script. This method is also used by the scheduler client.
procedure parameters_init;

procedure parameter(
    p_parameter_name  in varchar2,
    p_value_number    in number);

procedure parameter(
    p_parameter_name  in varchar2,
    p_value_date      in date);

procedure parameter(
    p_parameter_name  in varchar2,
    p_value_varchar2  in varchar2);

procedure parameter(
    p_parameter_name  in varchar2,
    p_value_boolean   in boolean);

procedure submit(
    p_script_name in varchar2,
    p_script_owner in varchar2 default null);
  
Parameter Description
p_parameter_name The name of the script parameter.
p_value_number The numeric value.
p_value_date The date value.
p_value_varchar2 The varchar2 value.
p_value_boolean The boolean value.
p_script_owner The scheduler user who created the scheduler script.
The value is not case sensitive.
p_script_name The scheduler script name.
The name is not case sensitive.
Error Description
OSC-10000
SCRIPT PARAMETER "%1"."%2"."%3" VALUE LENGTH "%4" EXCEEDS MAXIMUM "%5"
OSC-10002
SCRIPT PARAMETER "%1"."%2"."%3" VALUE CANNOT BE NULL
OSC-10005
SCRIPT PARAMETER "%1"."%2"."%3" VALUE "%4" NO DECIMALS ALLOWED
OSC-10006
SCRIPT PARAMETER "%1"."%2"."%3" VALUE "%4" TOO MANY DECIMALS "%5"
OSC-10007
SCRIPT PARAMETER "%1"."%2"."%3" VALUE WRONG DATATYPE "%4" (NEEDED "%5")
OSC-10008
SCRIPT "%1"."%2" DOES NOT EXIST
OSC-10009
SCRIPT PARAMETER "%1"."%2"."%3" DOES NOT EXIST FOR TASK "%4"
OSC-10010
SCHEDULER USER "%1" CANNOT ACCESS SCRIPT "%2"."%3"
OSC-10012
SCRIPT PARAMETER "%1"."%2"."%3" CANNOT HAVE A TIME PART
OSC-10014
ORACLE SQL ERROR INSERT SCHEDULER TASK "%1"
OSC-10015
SCRIPT "%1"."%2" IS BLOCKED
OSC-10017
SCHEDULER USER "%1" IS BLOCKED
OSC-10020
SCHEDULER USER "%1" HAS READ ACCESS
OSC-10025
FLOW TASK "%1" DOES NOT EXIST
OSC-10059
SCRIPT "%1"."%2" CAN ONLY BE SCHEDULED AS A CHILD

Example 2

Next the same scheduler script is submitted as the previous example with the above procedures.

Note that the datatype and the name of the script parameter must match with the corresponding SO_TASK.PARAMETER procedure.
begin
  so_task.parameters_init;
  so_task.parameter(
      p_parameter_name => 'P_LINES',
      p_value_number => 50);
  so_task.submit(
      p_script_name => 'LINESSCRIPT');
  so_task.committasks;
end;
/
  

Again each parameter must have exactly the same name as defined in the script.

Back to top 

Schedule a task

In most cases a task needs not to run now but at a different time, on particular days, at certain intervals in time, etc...
For this the procedure SO_TASK.SCHEDULE_CREATE is needed.

procedure schedule_create(
    p_task_comment              in varchar2 default null,
    p_task_status               in varchar2 default 'S',
    p_queue_name                in varchar2 default null,
    p_schedule_priority         in integer  default null,
    p_schedule_date             in date     default null,
    p_schedule_time             in varchar2 default null,
    p_schedule_moved            in date     default null,
    p_schedule_historical       in varchar2 default 'N',
    p_schedule_next_if_error    in varchar2 default 'N',
    p_schedule_restart_on_error in varchar2 default 'N',
    p_schedule_run_exclusive    in varchar2 default null,
    p_schedule_hold_exclusive   in varchar2 default null,
    p_schedule_shift_days       in integer  default 0,
    p_schedule_till             in date     default null,
    p_schedule_load             in integer  default 1,
    p_schedule_maximum_tasks    in integer  default 1,
    p_schedule_precreate_tasks  in varchar2 default 'N',
    p_schedule_keep_days        in integer  default null,
    p_trace_task                in varchar2 default 'N',
    p_trace_oracle              in varchar2 default 'N',
    p_repeat_number             in integer  default 1,
    p_repeat_till_time          in varchar2 default null,
    p_repeat_seconds            in integer  default null,
    p_repeat_minutes            in integer  default null,
    p_repeat_hours              in integer  default null,
    p_repeat_historical         in varchar2 default 'N',
    p_repeat_from_starttime     in varchar2 default 'N',
    p_repeat_precreate_tasks    in varchar2 default 'N',
    p_overtime_indication       in varchar2 default 'N',
    p_overtime_seconds          in integer  default null,
    p_overtime_minutes          in integer  default null,
    p_overtime_hours            in integer  default null,
    p_overtime_days             in integer  default null,
    p_flow_wait_for_task_id     in integer  default null,
    p_flow_reschedule           in varchar2 default 'Y',
    p_flow_restart              in varchar2 default 'Y',
    p_flow_finished             in varchar2 default 'A',
    p_flow_error                in varchar2 default 'E',
    p_flow_unknown              in varchar2 default 'E',
    p_flow_pass                 in varchar2 default 'P',
    p_flow_seconds              in integer  default null,
    p_flow_minutes              in integer  default null,
    p_flow_hours                in integer  default null,
    p_flow_days                 in integer  default null,
    p_copy_flow_from_task       in integer  default null,
    p_dbms_job_oracle_restart   in varchar2 default 'N',
    p_dbms_job_restart_wait     in integer  default null,
    p_monday                    in varchar2 default 'Y',
    p_tuesday                   in varchar2 default 'Y',
    p_wednesday                 in varchar2 default 'Y',
    p_thursday                  in varchar2 default 'Y',
    p_friday                    in varchar2 default 'Y',
    p_saturday                  in varchar2 default 'Y',
    p_sunday                    in varchar2 default 'Y',
    p_january                   in varchar2 default 'Y',
    p_february                  in varchar2 default 'Y',
    p_march                     in varchar2 default 'Y',
    p_april                     in varchar2 default 'Y',
    p_may                       in varchar2 default 'Y',
    p_june                      in varchar2 default 'Y',
    p_july                      in varchar2 default 'Y',
    p_august                    in varchar2 default 'Y',
    p_september                 in varchar2 default 'Y',
    p_october                   in varchar2 default 'Y',
    p_november                  in varchar2 default 'Y',
    p_december                  in varchar2 default 'Y',
    p_day_1                     in varchar2 default 'Y',
    p_day_2                     in varchar2 default 'Y',
    .. parameter day 3 till 29
    p_day_30                    in varchar2 default 'Y',
    p_day_31                    in varchar2 default 'Y',
    p_week_1                    in varchar2 default 'Y',
    p_week_2                    in varchar2 default 'Y',
    .. parameter week 3 till 51
    p_week_52                   in varchar2 default 'Y',
    p_week_53                   in varchar2 default 'Y');
  
Parameter Description
p_task_comment Contains comment about the scheduler task.
The comment is display only, the maximum size is hundred characters.
p_task_status The initial scheduler task status.
Allowed values are S for Scheduled and H for Hold; any other value will result in status scheduled.
p_queue_name The scheduler queue name.
The name is not case sensitive.
p_schedule_priority The priority of the scheduler task.
p_schedule_date The date used as a basis for calculating the final schedule date.
If no value is given the current date and time are used; the value of the oracle database function sysdate.
p_scheduled_time The time used for calculating the final schedule date.
The time part overrules the time part of the parameter p_schedule_date.
p_schedule_moved A new schedule date only applied to this task.
The scheduler task is activated exactly on this date and time; all other schedule settings are ignored.
p_schedule_next_if_error If set the scheduler task must be rescheduled even when it is ready with an error status.
If not set the scheduler task must be rescheduled manually.
This property only applies to scheduler tasks who are scheduled more than once.
p_schedule_restart_on_error If set the scheduler task is restarted immediate if the task is ready with status Error.
p_schedule_run_exclusive If set the scheduler task runs exclusive in the scheduler queue.
p_schedule_hold_exclusive If set other scheduler tasks must wait when this scheduler task needs exclusive access to the scheduler queue.
p_schedule_shift_days The number of days that must be added to each schedule date.
p_schedule_till The last date the scheduler task can be scheduled.
p_schedule_maximum_tasks The maximum number of times (days) the scheduler task can be scheduled.
p_schedule_precreate_tasks If set and the scheduler task is scheduled more than once then all the tasks are created immediately.
p_schedule_keep_days The number of days after which a ready scheduler task is deleted.
p_trace_task If set the scheduler trace is enabled.
p_trace_oracle If set an oracle trace file is generated containing all the sql statements used by the script program.
p_repeat_number The total times a scheduler task must be repeated.
p_repeat_[hours|minutes|seconds] The total of these three values determine the repeat interval between each repeated scheduler task.
p_repeat_historical If set the next repeated task can be scheduled before the current date and time, otherwise these scheduler tasks are skipped.
This parameter is ignored if parameter p_repeat_from_starttime is not set.
p_repeat_from_starttime If set the next repeat is scheduled at the schedule date of the last task incremented with the repeat interval period.
If not set the next repeat is schedule at the date and time the last repeated task was ready incremented with the repeat interval.
p_repeat_precreate_tasks If set all the repeated tasks are created immediately when the scheduler script is submitted.
This parameter is ignored if scheduler task precreate tasks is not set.
p_overtime_indication The overtime indication code.
p_overtime_[days|hours|minutes|seconds] The total of these four values determine the overtime period.
These parameters are ignored if no overtime is defined for this task.
p_flow_wait_for_task_id The flow task identifier this task must be waiting on.
p_flow_reschedule If set this scheduler task is also rescheduled when the previous flow task is rescheduled.
p_flow_restart If set this scheduler task is also restarted when the previous flow task is restarted.
p_flow_finished The flow action if the flow task has status Finished.
p_flow_error The flow action if the flow task has status Error.
p_flow_unknown The flow action if the flow task has status Unknown.
p_flow_pass The flow action if the flow task has status Passed.
p_flow_[seconds|minutes|hours|days] The sum of these values incremented with the schedule date of the very first flow task is the new schedule date of this task.
p_copy_flow_from_task When scheduled then the entire flow beneath this task id is also copied.
p_dbms_job_oracle_restart If set and the running scheduler task database session aborts abnormally (for example the database shuts down during execution) it is restarted.
p_dbms_job_restart_wait The period in seconds after which the scheduler task must be restarted.
p_[monday|tuesday|
wednesday|thursday|
friday|saturday|sunday]
If set the task is allowed to run on the specified day. If a task is created on monday and the monday is not set the task will be scheduled on tuesday.
p_[january|february|march|
april|may|june|july|august|
september|october|november|
december]
If set the scheduler task is allowed to run in that month.
p_day[1..31] If set the task is allowed to run on that specified day in any of the twelve months.
p_week[1..53] If set then the task is allowed to be scheduled on the specified week.
Error Description
OSC-10011
NO SCHEDULE DATE POSSIBLE
OSC-10023
SCHEDULE TIME "%1" HAS NOT FORMAT HH24:MI:SS
OSC-10024
CANNOT COMBINE RESTART ON ERROR AND OVERTIME ERROR
OSC-10025
FLOW TASK "%1" DOES NOT EXIST
OSC-10033
SCHEDULER USER "%1" HAS NO RIGHTS TO SCHEDULE "%2"
OSC-10058
TASK "%1" DOES NOT HAVE A FLOW
The schedule default values are set so that a task is scheduled now and is activated once.

Example 3

In this example a task is created that will be scheduled on every monday at 20:00 (for the next 100 weeks). Note that the result of TRUNC(SYSDATE) does not need to be a monday; if this is the case the task is scheduled the following monday.

begin
  so_task.schedule_create(
      p_queue_name => 'batch',
      p_tuesday => 'N',
      p_wednesday => 'N',
      p_thursday => 'N',
      p_friday => 'N',
      p_saturday => 'N',
      p_sunday => 'N',
      p_schedule_date => trunc(sysdate) + 20/24,
      p_schedule_maximum_tasks => 100);
  linesscript;
  so_task.committasks;
end;
/
  

Example 4

The next task will run every workday from 9:00 till 21:00 each 15 minutes. The first task will start tomorrow (or monday if it the command is executed on friday or saturday) and will be scheduled for the next 40 weeks (200 tasks divided by 5 tasks a week at 9:00).
If for some reason the task scheduled at 9:00 starts running at 11:10 then the next task will be scheduled at 11:15 (assuming the task finishes before 11:15) because parameter p_repeat_historical is not set. Thus the tasks for 9:15 till 11:00 are not created.

Always fill in the parameter p_repeat_number, a task is repeated till the given repeat till time or when the number of repeats has reached repeat number.
begin
   so_task.schedule_create(
       p_queue_name => 'batch',
       p_saturday => 'N',
       p_sunday => 'N',
       p_schedule_date => sysdate + 1,
       p_schedule_time => '09:00:00',
       p_repeat_till_time => '21:00:00',
       p_repeat_number => 100,
       p_repeat_minutes => 15,
       p_schedule_maximum_tasks => 200);
   linesscript;
   so_task.committasks;
end;
/
  

Example 5

In this example a flow is created consisting of three tasks. The second task will be activated immediatly after the first task is finished. The third task is activated after the seconds task is finished and is scheduled two minutes after the first task is scheduled.
The function SO_TASK.TASK_SUBMIT_ID returns the id of the last created task.

begin
  -- create first task
  so_task.schedule_create(
     p_schedule_time => '21');
  so_demo_sleep(60);
  -- create second task
  so_task.schedule_create(
     p_flow_wait_for_task_id => so_task.task_submit_id);
  so_demo_sleep(30);
  -- create third task
  so_task.schedule_create(
     p_flow_wait_for_task_id => so_task.task_submit_id,
     p_flow_minutes => 2);
  so_demo_sleep(10);
  so_task.committasks;
end;
/
  

The code of the above examples can be found in script taskscripts.txt.

Back to top 

Edit a task

If an existing task needs to be started at a different time or the priority and the queue needs to be changed we need the procedure SO_TASK.SCHEDULE_EDIT.

This procedure has the same parameters as procedure so_task.schedule_create plus some extra; we only display the extra parameters here.
procedure schedule_edit(
    p_task_id                   in integer,
    p_date_adjust_seconds       in integer  default null,
    p_date_adjust_minutes       in integer  default null,
    p_date_adjust_hours         in integer  default null,
    p_date_adjust_days          in integer  default null,
    p_date_adjust_at            in date     default null,
    p_move_adjust_seconds       in integer  default null,
    p_move_adjust_minutes       in integer  default null,
    p_move_adjust_hours         in integer  default null,
    p_move_adjust_days          in integer  default null,
    p_reschedule                in boolean  default true);
  
Parameter Description
p_task_id The scheduler task identifier.
p_date_adjust_[seconds|minutes|
hours|days]
Increment or decrement the schedule date with the specified time.
p_date_adjust_at Set the schedule date to this date but do not change the time part.
p_move_adjust_[seconds|minutes|
hours|days]
Increment or decrement the schedule move date with the specified time.
p_reschedule If set the new schedule is validated. If it is not valid a new schedule date is calculated.
Error Description
OSC-10019
TASK "%1" WITH STATUS "%2" CANNOT BE CHANGED
If a parameter is not assigned a value the associated task property is not changed.

Example 6

In this example first a task is created that runs only on monday every week at 20:00 (for the next 100 weeks).

begin
   so_task.schedule_create(
       p_queue_name => 'batch',
       p_tuesday => 'N',
       p_wednesday => 'N',
       p_thursday => 'N',
       p_friday => 'N',
       p_saturday => 'N',
       p_sunday => 'N',
       p_schedule_date => trunc(sysdate) + 20/24,
       p_schedule_maximum_tasks => 100);
   -- display 50 lines in the output
   linesscript(50);
   so_task.committasks;
end;
/
  

Now 1 is added to the scheduled date using parameter p_adjust_days. Because parameter p_reschedule is true (= the default) a new valid schedule date is calculated and so the task is rescheduled on the next monday (because monday is the only valid day).

begin
  so_task.schedule_edit(
      p_task_id => so_task.task_submit_id,
      p_date_adjust_days => 1);
end;
/
  

The task is again rescheduled and 1 is added to the tasks scheduled date. Because parameter p_reschedule is set to false the new schedule date is not validated so the task is scheduled on tuesday.
When the task is ready the next schedule will be the following monday again.

begin
  so_task.schedule_edit(
      p_task_id => so_task.task_submit_id,
      p_date_adjust_days => 1,
      p_reschedule => false);
end;
/
  

Next the task is rescheduled to run on every thursday instead of monday.

begin
  so_task.schedule_edit(
      p_task_id => so_task.task_submit_id,
      p_monday => 'N',
      p_thursday => 'Y');
end;
/
  

The code for this example can be found in script taskreschedule.txt.

Back to top 

Skip scheduled tasks

There are two overloaded procedures located in the SO_TASK package for skipping scheduled tasks.

procedure schedule_skip(
    p_task_id in integer,
    p_skip_tasks in integer default 1,
    p_adjust_maximum_tasks in boolean default true);
 
procedure schedule_skip(
    p_task_id in integer,
    p_skip_till in date,
    p_adjust_maximum_tasks in boolean default true);
  
Parameter Description
p_task_id The scheduler task identifier.
p_skip_tasks The number of scheduler tasks that must be skipped.
If the value of this parameter is NULL or less than 1 the task is not skipped.
p_skip_till The date until the scheduler tasks must be skipped.
The task is not skipped if the value of the date is NULL or lies before the current scheduled date.
p_adjust_maximum_tasks If this parameter is set then for each skipped task the maximum number of executions is decremented.
If the number of skipped tasks is more than the maximum number of allowed tasks error OSC-10021 is raised.
Error Description
OSC-10008
SCRIPT "%1"."%2" DOES NOT EXIST
OSC-10010
SCHEDULER USER "%1" CANNOT ACCESS SCRIPT "%2"."%3"
OSC-10013
USER "%1" IS NOT REGISTERED
OSC-10015
SCRIPT "%1"."%2" IS BLOCKED
OSC-10017
SCHEDULER USER "%1" IS BLOCKED
OSC-10018
TASK "%1" DOES NOT EXIST
OSC-10019
TASK "%1" WITH STATUS "%2" CANNOT BE CHANGED
OSC-10020
SCHEDULER USER "%1" HAS READ ACCESS
OSC-10021
TASK "%1" CANNOT BE SKIPPED; LAST SCHEDULE AT "%2"

Example 7

In this example a task is created that runs only on wednesday at 19:15.

begin
   so_task.schedule_create(
       p_queue_name => 'batch',
       p_monday => 'N',
       p_tuesday => 'N',
       p_thursday => 'N',
       p_friday => 'N',
       p_saturday => 'N',
       p_sunday => 'N',
       p_schedule_time => '19:15',
       p_schedule_maximum_tasks => 100);
   linesscript;
   so_task.committasks;
end;
/
  

Now the task is skipped the next two weeks.

begin
  so_task.schedule_skip(
      p_task_id => so_task.task_submit_id,
      p_skip_tasks => 2);
end;
/
  

The example can be found in file taskskip.txt.

Back to top 

Edit task parameters

For changing the task parameter values the same four SO_TASK.PARAMETER procedures are used as when creating a new task.
The difference is that instead of calling the procedure SO_TASK.SUBMIT the procedure SO_TASK.PARAMETERS_CHANGE must be called.

Only the parameters that are changed need to be specified.
procedure parameters_change(
    p_task_id in integer);
  
Parameter Description
p_task_id The scheduler task identifier.
Error Description
OSC-10008
SCRIPT "%1"."%2" DOES NOT EXIST
OSC-10009
SCRIPT PARAMETER "%1"."%2"."%3" DOES NOT EXIST FOR TASK "%4"
OSC-10010
SCHEDULER USER "%1" CANNOT ACCESS SCRIPT "%2"."%3"
OSC-10013
USER "%1" IS NOT REGISTERED
OSC-10015
SCRIPT "%1"."%2" IS BLOCKED
OSC-10017
SCHEDULER USER "%1" IS BLOCKED
OSC-10018
TASK "%1" DOES NOT EXIST
OSC-10019
TASK "%1" WITH STATUS "%2" CANNOT BE CHANGED
OSC-10020
SCHEDULER USER "%1" HAS READ ACCESS
OSC-10022
TASK "%1" IS A CHILD TASK; PARAMETERS CANNOT BE CHANGED

Example 8

In this example a task is created with scheduler script LINESSCRIPT and the parameter value 50.

variable v_last_task_id number
begin
   so_task.schedule_create(
       p_queue_name => 'batch',
       p_schedule_maximum_tasks => 10,
       p_schedule_time => '20:10');
   -- create task with parameter value 50 
   linesscript(lines => 50);
   -- after the creation of a task
   -- the last task id can be retrieved using
   -- function so_task.task_submit_id
   :v_last_task_id := so_task.task_submit_id;
   so_task.committasks;
end;
/
  

The parameter value can be found using view database view SO_VW_TASK_PARAMETERS.

select task_id,
       substr(parameter_name,1,12) parameter,
       value_number
from   so_vw_task_parameters
where  task_id = :v_last_task_id
/

        TASK_ID PARAMETER       VALUE_NUMBER
=============== ============ ===============
         265614 LINES                     50
  

Next the numeric parameter value is changed to 30.
Note that the datatype of the task parameter must match with the SO_TASK.PARAMETER procedure.

begin
  so_task.parameters_init;
  so_task.parameter(
      p_parameter_name => 'lines',
      p_value_number => 30);
  so_task.parameters_change(
      p_task_id => :v_last_task_id);
end;
/
  

This example can be found in file taskparameter.txt.

Back to top 

Hold tasks

The procedure SO_TASK.SCHEDULE_EDIT is used to set the scheduler task status from Scheduled to Hold.

Example 9

begin
  so_task.schedule_edit(
     p_task_id => :v_last_task_id,
     p_task_status => 'H');
end;
/
  

The task can get status Scheduled back with the same procedure.

begin
  so_task.schedule_edit(
     p_task_id => :v_last_task_id,
     p_task_status => 'S');
end;
/
  
Back to top 

Restart tasks

procedure task_restart(
    p_task_id in integer,
    p_schedule_date in date default null);
  
Parameter Description
p_task_id The scheduler task identifier.
p_schedule_date The date used as a basis for calculating the final schedule date.
If no value is given the current date and time are used; the value of the oracle database function sysdate.
Error Description
OSC-10008
SCRIPT "%1"."%2" DOES NOT EXIST
OSC-10010
SCHEDULER USER "%1" CANNOT ACCESS SCRIPT "%2"."%3"
OSC-10013
USER "%1" IS NOT REGISTERED
OSC-10015
SCRIPT "%1"."%2" IS BLOCKED
OSC-10017
SCHEDULER USER "%1" IS BLOCKED
OSC-10018
TASK "%1" DOES NOT EXIST
OSC-10019
TASK "%1" WITH STATUS "%2" CANNOT BE CHANGED
OSC-10020
SCHEDULER USER "%1" HAS READ ACCESS
OSC-10068
TASK "%1" CANNOT BE RESTARTED
Back to top 

Delete tasks

procedure task_delete(
    p_task_id in integer);
  
Parameter Description
p_task_id The scheduler task identifier.
Error Description
OSC-10008
SCRIPT "%1"."%2" DOES NOT EXIST
OSC-10010
SCHEDULER USER "%1" CANNOT ACCESS SCRIPT "%2"."%3"
OSC-10013
USER "%1" IS NOT REGISTERED
OSC-10015
SCRIPT "%1"."%2" IS BLOCKED
OSC-10017
SCHEDULER USER "%1" IS BLOCKED
OSC-10018
TASK "%1" DOES NOT EXIST
OSC-10020
SCHEDULER USER "%1" HAS READ ACCESS
Back to top 

Kill tasks

procedure task_kill(
    p_task_id in integer);
  
Parameter Description
p_task_id The scheduler task identifier.
Error Description
OSC-10008
SCRIPT "%1"."%2" DOES NOT EXIST
OSC-10010
SCHEDULER USER "%1" CANNOT ACCESS SCRIPT "%2"."%3"
OSC-10013
USER "%1" IS NOT REGISTERED
OSC-10016
TASK "%1" WITH STATUS "%2" CANNOT BE KILLED
OSC-10017
SCHEDULER USER "%1" IS BLOCKED
OSC-10018
TASK "%1" DOES NOT EXIST
OSC-10020
SCHEDULER USER "%1" HAS READ ACCESS
Back to top 

Suspend tasks

procedure task_suspend(
    p_task_id in integer,
    p_suspend_till in date);
  
Parameter Description
p_task_id The scheduler task identifier.
p_suspend_till The date and time untill the scheduler task is suspended.
If no value is passed the suspend date is 1 january 4000.
Error Description
OSC-10008
SCRIPT "%1"."%2" DOES NOT EXIST
OSC-10010
SCHEDULER USER "%1" CANNOT ACCESS SCRIPT "%2"."%3"
OSC-10013
USER "%1" IS NOT REGISTERED
OSC-10017
SCHEDULER USER "%1" IS BLOCKED
OSC-10018
TASK "%1" DOES NOT EXIST
OSC-10020
SCHEDULER USER "%1" HAS READ ACCESS
OSC-10066
TASK "%1" SUSPEND IS DISABLED
OSC-10067
TASK "%1" WITH STATUS "%2" CANNOT BE SUSPENDED

Example 10

In this example task 1234 is suspended till midnight.

exec so_task.task_suspend(1234,trunc(sysdate+1));
  

A suspended task can be unsuspended by setting the suspend date equal to or before the current date and time.
The next command disables the suspend mode for task 1234.

exec so_task.task_suspend(1234,sysdate);
  
Back to top