Home > Database > Mysql Tutorial > Mysql中delimiter作用_MySQL

Mysql中delimiter作用_MySQL

WBOY
Release: 2016-06-01 13:16:53
Original
1089 people have browsed it

1. delimiter

delimiter是mysql分隔符,在mysql客户端中分隔符默认是分号(;)。如果一次输入的语句较多,并且语句中间有分号,这时需要新指定一个特殊的分隔符。

2. delimiter使用

在前一篇中有设置mysql的触发器时使用例子
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 > 100 then    ->  set new.amount = 100;    -> end if;    -> end;    -> //Query OK, 0 rows affected (0.00 sec)mysql> delimiter ;
Copy after login
上面就是,先将分隔符设置为 //, 直到遇到下一个 //,才整体执行语句。执行完后,最后一行, delimiter ; 将mysql的分隔符重新设置为分号;如果不修改的话,本次会话中的所有分隔符都以// 为准。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template