SQL DDLシ壹ヨ繝ェ繧ャ繝シ螳夂セゥ

CREATE TRIGGER

蝓コ譛ャ讒区枚

CREATE (OR REPLACE) TRIGGER 繝医Μ繧ャ繝シ蜷
(BEFOR/AFTER/INSTEAD OF)
(INSERT/UPDATE [OF 蛻怜錐]/DELETE) (OR INSERT/OR UPDATE [OF 蛻怜錐]/OR DELETE) ON 陦ィ蜷
(FOR EACH ROW)
DECLARE
BEGIN
縲ス;
EXCEPTION
縲ス;
END;

CREATE OR REPLACE TRIGGER TEST
AFTER INSERT OR UPDATE OF 蛻怜錐 ON 陦ィ蜷 FOR EACH ROW
BEGIN
縲IF INSERT THEN
縲縲UPDATE 陦ィ蜷 SET 蛻怜錐 = ス;
縲ELSIF
縲縲UPDATE 陦ィ蜷 SET 蛻怜錐 = ス;
縲END IF;

縲UPDATE 陦ィ蜷 SET 蛻怜錐 = ス;
END;

繝医Μ繧ャ繝シ縺ョ螳溯。後ち繧、繝溘Φ繧ー

BEFOR
SQL螳溯。悟燕
AFTER
SQL螳溯。悟セ
INSTEAD OF
SQL繧貞ョ溯。後○縺壹↓繝医Μ繧ャ繝シ縺ョ縺ソ螳溯。

螳溯。悟屓謨ー

FOR EACH ROW
SQL譁縺ォ繧医▲縺ヲ隍謨ー陦後ョ繝繝シ繧ソ縺梧桃菴懊&繧後◆蝣エ蜷医
陦梧焚譁繝医Μ繧ャ繝シ繧貞ョ溯。後☆繧
縲熊OR EACH ROW縲肴欠螳壹′辟。縺蝣エ蜷医ッ縲1蝗槭ョSQL譁縺ァ1蝗槭ョ縺ソ繝医Μ繧ャ繝シ螳溯。悟ョ溯。

ALTER TRIGGER

繝医Μ繧ャ繝シ縺ョ譛牙柑/辟。蜉ケ 蛻繧頑崛縺
ALTER TRIGGER TEST ENABLE;
ALTER TRIGGER TEST DISABLE;

DROP TRIGGER

繝医Μ繧ャ繝シ縺ョ蜑企勁
DROP TRIGGER TEST;

Follow me!

谺。縺ョ險倅コ

SQL DDLシ夊。ィ鬆伜沺