Roles of delimiter in Mysql

Source: Internet
Author: User

1. delimiter
Delimiter is the mysql separator, and the default delimiter In the mysql client is semicolon (;). If many statements are input at a time and there is a semicolon in the middle of the statement, a special separator needs to be specified.
2. Use delimiter
Example of setting a mysql trigger in the previous article

Mysql> delimiter // mysql> create trigger upd_check before update on account-> for each row-> begin-> if new. amount <0 then-> set new. amount = 0;-> elseif new. amount & gt; 100 then-& gt; set new. amount = 100;-> end if;-> end;-> // Query OK, 0 rows affected (0.00 sec) mysql> delimiter;

In the preceding example, the separator is set to //, and the entire statement is executed only when the next // is encountered. After the execution, the last line is delimiter. Set the mysql separator to a semicolon. If this parameter is not modified, all the separators in this session are subject.
Address: http://blog.csdn.net/yonggang7/article/details/24558385



Related Article

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.