'could anyone help me to write a code to this question?
An HR system has an Employee table that holds a row for each employee within the company. Each record in the table has a employee id, employee name and manager column, that holds the id for the employee's manager. Write a trigger so that when an employee record is deleted, the record details need to be inserted into an table called Employee_archive along with the deleted date.
EMPLOYEE:
EMPID NUMBER PRIMARY KEY
EMPNAME VARCHAR2(25)
MANAGERID NUMBER
EMPLOYEE_ARCHIVE:
EMPID NUMBER PRIMARY KEY
EMPNAME VARCHAR2(25)
MANAGERID NUMBER
DELETED_DATE DATE
(Hint: Data is case sensitive. Use '/' to terminate the PLSQL block)
Solution 1:[1]
Seems to be pretty simple:
create or replace trigger trg_bd_emp
before delete on employee
for each row
begin
insert into employee_archive (empid, empname, managerid, deleted_date)
values (:old.empid, :old.empname, :old.managerid, sysdate);
end trg_bd_emp;
/
Though, what is that hint supposed to mean? What does letter case have to do with the problem?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Littlefoot |
