全部产品

SET VARIABLE

描述

该语句用来设置用户自定义和系统定义的 session 变量。

格式

SET var1_name = var1_value, var2_name = var2_value, ...;

参数解释

参数

描述

var1_name

指定要设置的变量,可以是用户自定义的变量,也可以是系统变量。如果要设置多个变量,中间用 , 分隔。

示例

OceanBase(TEST@TEST)>set @a = 1, @b = 2, @c = 3;
Query OK, 0 rows affected (0.02 sec)

OceanBase(TEST@TEST)>set @@tx_isolation = 'read-what';
ORA-00600: internal error code, arguments: -5145, Variable 'tx_isolation' can't be set to the value of 'read-what'

OceanBase(TEST@TEST)>set @@tx_isolation = 'read-committed';
Query OK, 0 rows affected (0.01 sec)

OceanBase(TEST@TEST)>select @a,@b,@c,@@tx_isolation from dual;
+------+------+------+----------------+
| @A   | @B   | @C   | @@TX_ISOLATION |
+------+------+------+----------------+
|    1 |    2 |    3 | read-committed |
+------+------+------+----------------+
1 row in set (0.01 sec)