Purpose
Aborts any outstanding request or transaction of one or more sessions, and optionally logs those sessions off Teradata Database.
Definition
REPLACE FUNCTION SYSLIB.AbortSessions (HostIdIn SMALLINT, UserNameIn TD_ANYTYPE, SessionNoIn INTEGER, LogoffSessions VARCHAR(1) CHARACTER SET LATIN, UserOverride VARCHAR(1) CHARACTER SET LATIN ) RETURNS INTEGER . . . ;
Input Parameters
Parameter | Description |
---|---|
HostIdIn | Logical ID of a host (or client) with sessions logged on. A value of -1 indicates all hosts. |
UserNameIn | User name of the session. An asterisk (*) or NULL indicates all users. |
SessionNoIn | ID of the session to abort. A value of zero indicates all sessions. |
LogoffSessions | Indicator of whether to log off sessions to Teradata Database in addition to aborting them:
|
UserOverride | Indicator of whether to override an ABORT SESSION failure: Y = Override the ABORT SESSION request to fail in any of the following cases:
N or NULL = Do not override. |
Usage Notes - AbortSessions
The AbortSessions function provides similar functionality to the PMPC ABORT SESSION request with ListSessions set to ‘Y’ or ‘Yes’. For information about this interface, see ABORT SESSION.
Return Value
If successful, this function returns the number of sessions that were aborted.
Example: Using AbortSessions
SELECT AbortSessions (1, 'User14', 0, 'Y', 'Y'); * * * Query completed. One row found. one column returned. * * * Total elapsed time was 5 seconds. AbortSessions (1, 'User14', 0, 'Y', 'Y') ---------------------------------------- 5
Example: Using AbortSessions with MonitorSession
SELECT AbortSessions (HostId, UserName, SessionNo, 'Y', 'Y'); FROM TABLE (MonitorSession(-1, '*', 0)) AS t1 WHERE username= 'user14'; * * * Query completed. 5 rows found. one column returned. * * * Total elapsed time was 2 seconds. AbortSessions (HostId, UserName, SessionNo, 'Y', 'Y') ---------------------------------------------------- 1 1 1 1