我正在尝试创建一个触发器,当我们从 nm_employees 表中删除值时,该触发器会将值输入到表 terminate_employees 中。我已经编写了触发器,但是我收到了 PL 语句的编译错误。有任何想法吗?
CREATE TABLE nm_departments(
dept2 varchar(20),
CONSTRAINT empPK PRIMARY KEY (dept2)
);
CREATE TABLE nm_employees(
name varchar(20),
dept varchar(20),
CONSTRAINT departments FOREIGN KEY (dept) REFERENCES nm_departments (dept2)ON DELETE CASCADE
);
CREATE TABLE terminated_employees(
te_name varchar(20),
te_dept varchar(20)
);
CREATE OR REPLACE TRIGGER DeleteCustomer
BEFORE DELETE ON nm_employees
FOR EACH ROW
BEGIN
INSERT INTO terminated_employees (te_name,te_dept)
VALUES(:Old.te_name, :Old.te_dept);
END DeleteCustomer;