Oracle触发器的写法有三种:行级触发器、语句级触发器和嵌套表触发器。
NEW
和OLD
伪记录。CREATE OR REPLACE TRIGGER trigger_name
BEFORE INSERT OR UPDATE OR DELETE ON table_name
FOR EACH ROW
BEGIN
-- 触发器逻辑
END;
/
NEW
和OLD
伪记录。CREATE OR REPLACE TRIGGER trigger_name
BEFORE INSERT OR UPDATE OR DELETE ON table_name
BEGIN
-- 触发器逻辑
END;
/
NEW
和OLD
伪记录。CREATE OR REPLACE TRIGGER trigger_name
BEFORE INSERT OR UPDATE OR DELETE ON table_name
FOR EACH ROW
DECLARE
TYPE nested_table_type IS TABLE OF table_name.column_name%TYPE;
nested_table nested_table_type;
BEGIN
-- 触发器逻辑
END;
/
以上是Oracle触发器的三种常见写法,根据实际需求选择合适的触发器类型进行编写。