Oracle 5.0 Reference Manual page 1191

Table of Contents

Advertisement

SET
@var_name
= expr;
Many system variables are dynamic and can be changed while the server runs by using the
statement. For a list, see
with SET, refer to it as var_name, optionally preceded by a modifier:
• To indicate explicitly that a variable is a global variable, precede its name by
The
[578]
privilege is required to set global variables.
SUPER
• To indicate explicitly that a variable is a session variable, precede its name by SESSION,
@@session., or @@. Setting a session variable requires no special privilege, but a client can change
only its own session variables, not those of any other client.
and
LOCAL
@@local.
• If no modifier is present,
A
statement can contain multiple variable assignments, separated by commas. For example,
SET
the statement can assign values to a user-defined variable and a system variable. If you set several
system variables, the most recent
variables that have no modifier specified.
Examples:
SET sort_buffer_size=10000;
SET @@local.sort_buffer_size=10000;
SET GLOBAL sort_buffer_size=1000000, SESSION sort_buffer_size=1000000;
SET @@sort_buffer_size=1000000;
SET @@global.sort_buffer_size=1000000, @@local.sort_buffer_size=1000000;
The
syntax for system variables is supported for compatibility with some other database
@@var_name
systems.
If you change a session system variable, the value remains in effect until your session ends or until you
change the variable to a different value. The change is not visible to other clients.
If you change a global system variable, the value is remembered and used for new connections until
the server restarts. (To make a global system variable setting permanent, you should set it in an option
file.) The change is visible to any client that accesses that global variable. However, the change affects
the corresponding session variable only for clients that connect after the change. The global variable
change does not affect the session variable for any client that is currently connected (not even that of
the client that issues the
To prevent incorrect usage, MySQL produces an error if you use
can only be used with
SET SESSION
global variable.
To set a
variable to the
SESSION
value, use the
DEFAULT
session value of
max_join_size
SET max_join_size=DEFAULT;
SET @@session.max_join_size=@@global.max_join_size;
Not all system variables can be set to DEFAULT. In such cases, use of
It is not permitted to assign the value
procedure or function parameters or stored program local variables. This results in a syntax error for
user-defined variables, and the results are undefined for parameters or local variables.
You can refer to the values of specific global or session system variables in expressions by using one
of the @@-modifiers. For example, you can retrieve values in a
Syntax
SET
Section 5.1.5.2, "Dynamic System
are synonyms for
SESSION
changes the session variable.
SET
or
GLOBAL
SESSION
statement).
SET GLOBAL
or if you do not specify
value or a
GLOBAL
keyword. For example, the following two statements are identical in setting the
[469]
to the global value:
to user-defined variables, and not supported for stored
DEFAULT
1171
Variables". To change a system variable
and @@session..
modifier in the statement is used for following
SET GLOBAL
(or @@global.) when setting a
GLOBAL
value to the compiled-in MySQL default
GLOBAL
DEFAULT
statement like this:
SELECT
SET
or @@global..
GLOBAL
with a variable that
results in an error.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents