Description
This statement modifies the status of a session.
ALTER SESSION has the statements of multiple features. ApsaraDB for OceanBase supports the following three features:
Switching the database to which the current session connects.
Modifying the isolation level of the current session.
Specifying the session variables. You can specify multiple variables in the same statement.
Syntax
ALTER SESSION SET CURRENT_SCHEMA = current_schema;
ALTER SESSION SET ISOLATION_LEVEL = [READ UNCOMMITTED|READ COMMITTED|REPEATABLE READ|SERIALIZABLE];
ALTER SESSION SET var1_name = var1_value var2_name = var2_value ... ;
Parameter description
| Parameter | Description |
|---|---|
| CURRENT_SCHEMA | Specifies the name of the database to which the connected session switches. |
| ISOLATION_LEVEL | Specifies the isolation level of the session. |
| var1_name = var1_value var2_name = var2_value ... | Specifies the name and the value of the session variable. When you specify multiple variables, the variables are not separated by commas (,). |
Examples
- Change the values of the recyclebin, sql_warnings, and tx_isolation variables of a session.
OceanBase(TEST@TEST)>alter session set recyclebin = 'on' sql_warnings = 'on' tx_isolation = 'read-committed';
Query OK, 0 rows affected (0.01 sec)