Use this statement to terminate a user session or query.
The user requires the system privilege KILL ANY SESSION to terminate a foreign session or query.
- If you kill the session of a user, the user gets an error message and is logged out of the database.
- KILL STATEMENT terminates the current statement of the corresponding session, but not the session itself. If you specify a statement id, you can constrain the termination to a certain statement of a session. If this statement does not exist anymore (already finished), then an exception will be thrown. The termination of statements is similar to the Query Timeout (for more information, see ALTER SESSION or ALTER SYSTEM ). When a statement is terminated, it may finish with an exception within a few seconds through an internal cancellation point. If this fails (for example because there are no such cancellation points or the query is slowed down due to disk operations) the query is terminated forcefully and the transaction is rolled back (including an internal reconnect). If the affected statement is part of EXECUTE SCRIPT, the whole script is terminated.
- By the optional WITH MESSAGE clause you are able to specify a string that will be displayed to the user as part of the corresponding error message. This mechanism can be used to indicate the reason for the query termination.