Information Schema USER_VARIABLES Table

Description

The USER_VARIABLES table is created when the user_variables plugin is enabled, and contains information about user-defined variables.

The table contains the following columns:

Column
Description

Column

Description

VARIABLE_NAME

Variable name.

VARIABLE_VALUE

Variable value.

VARIABLE_TYPE

Variable type.

CHARACTER_SET_NAME

User variables are reset and the table emptied with the FLUSH USER_VARIABLES statement. SHOW USER_VARIABLES displays a subset of the data.

Example

SET @v1 = 0;
SET @v2 = 'abc';
SET @v3 = CAST(123 AS CHAR(5));

SELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;
+---------------+----------------+---------------+--------------------+
| VARIABLE_NAME | VARIABLE_VALUE | VARIABLE_TYPE | CHARACTER_SET_NAME |
+---------------+----------------+---------------+--------------------+
| v1            | 0              | INT           | latin1             |
| v2            | abc            | VARCHAR       | utf8               |
| v3            | 123            | VARCHAR       | utf8               |
+---------------+----------------+---------------+--------------------+

SHOW USER_VARIABLES;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| v3            | 123   |
| v2            | abc   |
| v1            | 0     |
+---------------+-------+

See Also

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?