Translation: SET Variable (submitted to MARIADB official manual)

Source: Internet
Author: User

This is the Official Handbook for MARIADB: The translation of SET variable.

Original:https://mariadb.com/kb/en/set-variable/
I submit it to MARIADB official manual:https://mariadb.com/kb/zh-cn/set-variable/

Grammar
SET var_name = expr [, var_name = expr] ...

The statements in the stored program stored programs SET are an extended function of the normal SET statement. Variable reference, you can refer to the stored program internal, global system variables, or user-defined variables.

The statements in the stored program SET are implemented as part of the existing SET syntax. This allows extended SET a = x,b = y,... syntax, where you can mix different variable types (locally declared variables, global system variables, and session system variables, user-defined variables). Also allows the combination of local variables and some options that make sense only for system variables; In this case, although the option is recognized, it is ignored.

SETYou can assign values to local variables locally variables and user-defined variables user-defined variables .

When you assign values to multiple variables by using the column values returned by the query, you should prioritize using SELECTinto.

When assigning the same value to multiple variables, you can use the function last_value ().

The following is an example of an assignment of a user-defined variable:

 SET @x = 1;Example of a translator supplement: set assigns values to multiple types of variables, noting that when one of the variables fails, the entire statement fails set @x = 1, SESSION sql_mode = " ; SET GLOBAL sort_buffer_size = 1000000, SESSION sort_buffer_size =  1000000;  SET @@ Global sort_buffer_size = 1000000, @@ Global. Sort_buffer_size = 1000000; SET GLOBAL max_connections = sort_buffer_size = 1000000;

Back to Linux series article outline: http://www.cnblogs.com/f-ck-need-u/p/7048359.html
Back to Site Architecture series article outline: http://www.cnblogs.com/f-ck-need-u/p/7576137.html
Back to Database series article outline: http://www.cnblogs.com/f-ck-need-u/p/7586194.html
Reprint Please specify source: http://www.cnblogs.com/f-ck-need-u/p/8620767.html

Note: If you think this article is not bad please click on the lower right corner of the recommendation, your support can inspire the author more enthusiasm for writing, thank you very much!

Translation: SET Variable (submitted to MARIADB official manual)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.