6.16 GET_TASKS Function

This function gets the tasks of a user depending on the given context.

Context can be one of the following:

  • MY_TASKS - Returns all tasks where the user calling the function is either the Owner or one of the Potential Owners of the task.
  • ADMIN_TASKS - Returns all tasks for which the user calling the function is a Business Administrator.
  • INITIATED_BY_ME - Returns all tasks where the user calling the function is the Initiator.
  • SINGLE_TASK - Returns the task identified by the P_TASK_ID input parameter.

This function only returns data in the context of a valid Oracle APEX session. It returns no data in SQL Workshop.

Syntax

APEX_APPROVAL.GET_TASKS (
    p_context            IN VARCHAR2 DEFAULT wwv_flow_approval_api.c_context_my_tasks,
    p_user               IN VARCHAR2 DEFAULT wwv_flow_security.g_user,
    p_task_id            IN NUMBER   DEFAULT NULL,
    p_application_id     IN NUMBER   DEFAULT NULL,
    p_show_expired_tasks IN VARCHAR2 DEFAULT 'N' )
RETURN wwv_flow_t_approval_tasks pipelined;

Parameters

Table 6-14 GET_TASKS Parameters

Parameter Description
p_context The list context. Default is MY_TASKS.
p_user The user to check for. Default is logged-in user. Requires p_context set to MY_TASKS, ADMIN_TASKS or INITIATED_BY_ME.
p_task_id Filter for a task ID instead of a user. Default is null. Requires p_context set to SINGLE_TASK.
p_application_id Filter for an application. Default is null (all applications).
p_show_expired_tasks If set to Y the tasks returned include tasks which are in Expired state.

Returns

A table of tasks (type apex_t_approval_tasks).

Example

select * from table ( apex_approval.get_tasks ( p_context => 'MY_TASKS', p_show_expired_tasks => 'Y') )