|
-
Thanks for the reply.
Here is actual trigger that works according to my requirement
create or replace trigger TRG_EMPLOYEE_UPDATES
before insert or update on EMPLOYEE
for each row
begin
if (updating) then
insert into EMPLOYEE_UPDATES
( EMP_KEY,
EMP_ID,
EMP_TYPE,
START_DATE,
END_DATE,
TOT_SAL,
CUR_IND
)
values
( SEQ_EMP_KEY.nextval,
:new.EMP_ID,
:new.EMP_TYPE,
:new.START_DATE,
:new.END_DATE,
:new.TOT_SAL,
'U'
);
else
insert into EMPLOYEE_UPDATES
( EMP_KEY,
EMP_ID,
EMP_TYPE,
START_DATE,
END_DATE,
TOT_SAL,
CUR_IND)
values
( SEQ_EMP_KEY.nextval,
:new.EMP_ID,
:new.EMP_TYPE,
:new.START_DATE,
:new.END_DATE,
:new.TOT_SAL,
'I');
end if;
end;
But i am trying to modify this by calling a procedure to updates and new recods.
Like this
CREATE OR REPLACE TRIGGER EMPLOYEE_UPDATES
BEFORE INSERT OR UPDATE ON EMPLOYEE
FOR EACH ROW
DECLARE
p_old_rec EMPLOYEE%ROWTYPE;
p_new_rec EMPLOYEE%ROWTYPE;
BEGIN
p_old_rec.emp_id := :OLD.emP_ID;
p_old_rec.emp_type := :OLD.emp_type;
p_old_rec.start_date := :OLD.start_DATE;
p_old_rec.end_date := :OLD.end_Date;
p_old_rec.tot_sal := :OLD.tot_sal;
p_new_rec.emp_id := :NEW.emp_ID;
p_new_rec.emp_type := :NEW.emp_type;
p_new_rec.start_date := :NEW.start_DATE;
p_new_rec.end_date := :new.end_date;
p_new_rec.tot_sal := :new.tot_sal;
spw_EMPLOYEE_UPDATES();
END IF;
END;
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
|