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觸發器的三種常見寫法,根據實際需求選擇合適的觸發器類型進行編寫。