(mysql.info) triggers
情報カタログ
(mysql.info) stored-procedures
(mysql.info) Top
(mysql.info) views
18 Triggers
***********
メニュー
* create-trigger `CREATE TRIGGER' Syntax
* drop-trigger `DROP TRIGGER' Syntax
* using-triggers Using Triggers
Support for triggers is included beginning with MySQL 5.0.2. A trigger
is a named database object that is associated with a table and that is
activated when a particular event occurs for the table. For example,
the following statements create a table and an `INSERT' trigger. The
trigger sums the values inserted into one of the table's columns:
mysql> CREATE TABLE account (acct_num INT, amount DECIMAL(10,2));
Query OK, 0 rows affected (0.03 sec)
mysql> CREATE TRIGGER ins_sum BEFORE INSERT ON account
-> FOR EACH ROW SET @sum = @sum + NEW.amount;
Query OK, 0 rows affected (0.06 sec)
This chapter describes the syntax for creating and dropping triggers,
and shows some examples of how to use them. Discussion of restrictions
on use of triggers is given in routine-restrictions. Remarks
regarding binary logging as it applies to triggers are given in
stored-procedure-logging.
情報カタログ
(mysql.info) stored-procedures
(mysql.info) Top
(mysql.info) views
より自動的に生成されましたinfo2html