-
Trigger to call a procedure
Hi all, i have two tables
1) Employee
2)Employee_Updates
Whenever i add a new record or update existing record in Employee table, that recod should go and insert into the Employee_updates table.
I want to do this by write a trigger that call a procedure.
Here are more details:
Emplyee table:CREATE TABLE EMPLOYEE
(
EMP_ID VARCHAR2(255 BYTE),
EMP_TYPE VARCHAR2(255 BYTE),
START_DATE DATE,
END_DATE DATE,
TOT_SAL VARCHAR2(255 BYTE)
)
Insert into EMPLOYEE (EMP_ID, EMP_TYPE, START_DATE, END_DATE, TOT_SAL) Values
('111', 'MANAGER', TO_DATE('01/10/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/10/2008 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'150000');
Insert into EMPLOYEE
(EMP_ID, EMP_TYPE, START_DATE, END_DATE, TOT_SAL)
Values
('222', 'MANAGER', TO_DATE('02/01/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('09/30/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'200000');
Insert into EMPLOYEE(EMP_ID, EMP_TYPE, START_DATE, END_DATE, TOT_SAL)
Values
('333', 'CONTRACTOR', TO_DATE('12/15/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/15/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'2500000');
EMPLOYEE_UPDATES Table
CREATE TABLE EMPLOYEE_UPDATES(
EMP_KEY NUMBER,
EMP_ID VARCHAR2(255 BYTE),
EMP_TYPE VARCHAR2(255 BYTE),
START_DATE DATE,
END_DATE DATE,
TOT_SAL VARCHAR2(255 BYTE),
CUR_IND VARCHAR2(1))
here EMP_KEY is a sequense number and CUR_IND is a indicater that tells when it is updated record or new record
Can someone help to do this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|