Syntax\n------\n\nSET var_name = expr [, var_name = expr] ...\n\nDescription\n-----------\n\nThe SET statement in stored programs is an extended version of the general SET statement. Referenced variables may be ones declared inside a stored program, global system variables, or user-defined variables.\n\nThe SET statement in stored programs is implemented as part of the pre-existing SET syntax. This allows an extended syntax of SET a=x, b=y, ... where different variable types (locally declared variables, global and session server variables, user-defined variables) can be mixed. This also allows combinations of local variables and some options that make sense only for system variables; in that case, the options are recognized but ignored.\n\nSET can be used with both local variables and user-defined variables.\n\nWhen setting several variables using the columns returned by a query, SELECT INTO should be preferred.\n\nTo set many variables to the same value, the LAST_VALUE( ) function can be used.\n\nBelow is an example of how a user-defined variable may be set:\n\n``sql\nSET @x = 1;\n``\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/programmatic-compound-statements/set-variable