Synopsis
Records a message in the Audit Log.
Description
Adds the specified message to the WS_WRK_AUDIT_LOG workflow metadata table, which is referred to as the Audit Log or Audit Trail. A variety of message types are supported such as Information, Warning, and Error that are included in the corresponding message type counts for the task and job. Audit Log messages are accessible via the "Scheduler" tab/window and/or the WS_ADMIN_V_AUDIT view of the WS_WRK_AUDIT_LOG table.

Note

Both the Audit Log and Error/Detail Log support similar information and in user-defined custom procedures, either or both logs can be used. However in RED-generated procedures/scripts, the Audit Log is used for higher-level or summary messages while the Error/Detail Log is used for more detailed supporting information.

Input

Input

Description

Common Input

Includes all 5 inputs of the Callable Routines Common Input.

Audit Message Type Code

Audit Message Type Code:

  • B - Beginning of a Job or Task.
  • I - Information.
  • S - Success.
  • W - Warning.
  • E - Error.
  • F - Fatal Error.

Audit Message Text

Custom message text to be recorded in the WhereScape RED Audit Log.

RDBMS Code

RDBMS-specific message code. e.g. The Oracle special variable SQLCODE. It is optional but recommended to populate this when an error occurs.

RDBMS Message

RDBMS-specific message. e.g. The Oracle special variable SQLERRM. It is optional but recommended to populate this when an error occurs.

Output

Output

Description

Result Number

Output Result Number:

  • 1 Success.
  • -3 Error.

SQL Server

SQL Server Parameters: WsWrkAudit
Callable Routine Type: PROCEDURE.

Parameter Name

Datatype

Mode

@p_status_code

VARCHAR(1)

IN

@p_job_name

VARCHAR(64)

IN

@p_task_name

VARCHAR(64)

IN

@p_sequence

INTEGER

IN

@p_message

VARCHAR(256)

IN

@p_db_code

VARCHAR(10)

IN

@p_db_msg

VARCHAR(256)

IN

@p_task_key

INTEGER

IN

@p_job_key

INTEGER

IN

SQL Server Examples: WsWrkAudit

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
DECLARE @p_sequence integer
DECLARE @p_job_name varchar(256)
DECLARE @p_task_name varchar(256)
DECLARE @p_job_id integer
DECLARE @p_task_id integer
DECLARE @p_return_msg varchar(256)
DECLARE @p_status integer
DECLARE @v_result_num integer
EXEC @v_result_num = WsWrkAudit
'I', @p_job_name, @p_task_name, @p_sequence
, 'The task has started.'
, NULL
, NULL
, @p_task_id
, @p_job_id

Teradata

Teradata Parameters: WsWrkAudit
Callable Routine Type: PROCEDURE.

Parameter Name

Datatype

Mode

p_status_code

VARCHAR(1)

IN

p_job_name

VARCHAR(64)

IN

p_task_name

VARCHAR(64)

IN

p_sequence

INTEGER

IN

p_message

VARCHAR(255)

IN

p_db_code

VARCHAR(10)

IN

p_db_msg

VARCHAR(255)

IN

p_task_key

INTEGER

IN

p_job_key

INTEGER

IN

Teradata Examples: WsWrkAudit

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
DECLARE p_sequence integer;
DECLARE p_job_name varchar(256);
DECLARE p_task_name varchar(256);
DECLARE p_job_id integer;
DECLARE p_task_id integer;
DECLARE p_return_msg varchar(256);
DECLARE p_status integer;
CALL [METABASE].WsWrkAudit
( 'I', p_job_name, p_task_name, p_sequence
, 'The task has started.'
, NULL
, NULL
, p_task_id
, p_job_id
);

Oracle

Oracle Parameters: WsWrkAudit
Callable Routine Type: FUNCTION.

Parameter Name

Datatype

Mode

v_status_code

VARCHAR2

IN

v_job_name

VARCHAR2

IN

v_task_name

VARCHAR2

IN

v_sequence

NUMBER

IN

v_message

VARCHAR2

IN

v_db_code

VARCHAR2

IN

v_db_msg

VARCHAR2

IN

v_task_key

NUMBER

IN

v_job_key

NUMBER

IN

FUNCTION Return Value

NUMBER

OUT-Function

Oracle Examples: WsWrkAudit

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
p_sequence number;
p_job_name varchar2(256);
p_task_name varchar2(256);
p_job_id number;
p_task_id number;
p_return_msg varchar2(256);
p_status number;
v_result_num number;
v_result_num := WsWrkAudit
( 'I', p_job_name, p_task_name, p_sequence
, 'The task has started.'
, NULL
, NULL
, p_task_id
, p_job_id
);

DB2

DB2 Parameters: WsWrkAudit
Callable Routine Type: PROCEDURE.

Parameter Name

Datatype

Mode

v_status_code

CHARACTER

IN

v_job_name

VARCHAR(64)

IN

v_task_name

VARCHAR(64)

IN

v_sequence

INTEGER

IN

v_message

VARCHAR(256)

IN

v_db_code

VARCHAR(10)

IN

v_db_msg

VARCHAR(256)

IN

v_task_key

INTEGER

IN

v_job_key

INTEGER

IN

DB2 Examples: WsWrkAudit

– The p_ VARIABLES are normally PARAMETERS in a RED-generated Procedure.
DECLARE p_sequence integer;
DECLARE p_job_name varchar(256);
DECLARE p_task_name varchar(256);
DECLARE p_job_id integer;
DECLARE p_task_id integer;
DECLARE p_return_msg varchar(256);
DECLARE p_status integer;
CALL [METABASE].WsWrkAudit
( 'I', p_job_name, p_task_name, p_sequence
, 'The task has started.'
, NULL
, NULL
, p_task_id
, p_job_id
);


  • No labels