MYSQL trigger
CREATE
[DEFINER = { user
| CURRENT_USER }]
TRIGGER trigger_name
trigger_time
trigger_event
ON tbl_name
FOR EACH ROW trigger_body
trigger_name =
customize name
trigger_time = after || before
trigger_event = insert || delete || update || loaddata || replace
trigger_body = BEGIN ..... END
[BEGIN ..... END]
procedural SQL
Exaple:
--------------------------------------------------------------------------------
-- Trigger DDL Statements
DELIMITER $$
USE `development_deploy`$$
CREATE
DEFINER=`et`@`%`
TRIGGER `xxxment_deploy`.`item_delete2_deploy`
AFTER DELETE ON `xxxment_deploy`.`ixxx`
FOR EACH ROW
begin
replace into deploy
values('Wxx','Sxx',OLD.sxx,NOW(),'','','','','','') ;
end$$
-------------------------------------------------------------------------------
No comments:
Post a Comment