ADMIN_TASK_OUTPUT table function

For an execution of a stored procedure, the ADMIN_TASK_OUTPUT function returns the output parameter values and result sets, if available. If the task that was executed is not a stored procedure or the requested execution status is not available, the function returns an empty table.

Authorization

The user who calls this function must have MONITOR1 privilege.

Read syntax diagramSkip visual syntax diagramADMIN_TASK_OUTPUT(task-name,num-invocations )

The schema is DSNADM.

Important: The ADMIN_TASK_OUTPUT function returns as many output parameter values and result sets as possible. However, this information is not always available. The administrative task scheduler cannot store output that exceeds 32,180 bytes in length. Therefore, some output parameters and result set values might be null if the values are too long to be stored by the administrative task scheduler. Also, if the result sets are too large to be stored, only some of the most recent rows of each result set might be available (for example, the first rows missing).
task-name
Specifies the unique name of the task whose execution output you want returned. This is an input parameter of type VARCHAR(128).
num-invocations
Specifies the execution number of the task whose output you want returned. This value must be a valid value in the NUM_INVOCATIONS column of the returned table of DSNADM.ADMIN_TASK_STATUS(NULL) for the specified task. This is an input parameter of type INTEGER.

The result of the function is a table with the format shown in the following table. This function might return an empty table for the output of a stored procedure for the following reasons:

  • The stored procedure does not have output parameters or result sets.
  • The output of the stored procedure was not stored at execution time, because the SYSIBM.ADMIN_TASKS_HIST table was not available.
  • The num-invocations parameter is not valid.
  • The output for the task that is specified by the num-invocations parameter is no longer stored, because the task is older than the value that is specified for the MAXHIST parameter of the administrative task scheduler. (The MAXHIST parameter specifies the maximum number of execution statuses to keep for each task.)
Table 1. Format of the resulting table for ADMIN_TASK_OUTPUT
Column name Data type Contains
RESULT_SET SMALLINT Contains the stored procedure result set number with a value beginning at 1, or NULL if this value is for an output parameter of the stored procedure.
ROW SMALLINT Contains the result set row number with a value beginning at 1, or NULL if this value is for an output parameter of the stored procedure.
COLUMN SMALLINT Contains the result set column number, or the index of an output parameter of the stored procedure parameters, with a value beginning at 1. Only the values of output parameters are returned, and the results include the index in all parameters of the stored procedure.
TYPE CHAR(8) Contains the type of the returned string. Possible types are:
  • DATE
  • TIME
  • TIMESTMP
  • CHAR
  • VARCHAR
  • FLOAT
  • BIGINT
  • INTEGER
  • SMALLINT
  • OTHER
The value OTHER includes all other data types that are not supported in this stored procedure.
VALUE VARCHAR(32180) Contains the string representation of the output parameter value or the result set column value. This column is null if the TYPE column contains OTHER.