I have created a trigger to insert values into Payroll once an entry to Employees have been made. But when I insert values into Employees , no values are entered into Payroll from the trigger. Payroll remains empty when I insert values into Employees. Any ideas?
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;