我创建了一个触发器,以便在输入员工后将值插入工资单。但是,当我将值插入到Employees 时,触发器中没有任何值输入到Payroll 中。当我将值插入员工时,工资单仍然为空。有任何想法吗?
CREATE TABLE Employees(
empid FLOAT,
dept FLOAT,
empname varchar2(25),
salary FLOAT
);
CREATE TABLE Payroll(
empid FLOAT,
salary FLOAT
);
CREATE OR REPLACE TRIGGER NewEmployee
AFTER INSERT
ON Employees
FOR EACH ROW
BEGIN
INSERT INTO Payroll
VALUES(:Old.empid,:Old.salary);
END;
/
INSERT INTO Employees values (1,1,‘supply’,50000);
INSERT INTO Employees values (2,2,‘hard’,80000);
Select * from Employees;
Select * from payroll;