By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,844 Members | 836 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,844 IT Pros & Developers. It's quick & easy.

How to execute trigger instead of view while changes are done on a field in the table

P: 1
Hi,

I have a problem and I hope that you help me :

I have a trigger "tr_view_emp_iu" INSTEAD OF a view "view_employee" the problem is if the changes is done on the field "first_name" in the table "employee" the trigger "tr_view_emp_iu" will not be executed.


create or replace view view_employee as
select e.emp_id, e.first_Name, e.last_name
from employee e
order by e.first_Name
;

create or replace trigger tr_view_emp_iu
INSTEAD OF UPDATE
on view_employee
declare
view_error VARCHAR2(256);
begin
if updating('first_name')
then
update employee
set First_Name = :new.First_Name
where emp_id = :old.emp_id;
end if;
end
;


My question is : How to make the trigger tr_view_emp_iu executable when changes will be done on the field "first_name" of the table "employee" related to the view "view_employee" not changes in the view itself but in the table of the view ?

N.B: THE VIEW IS READ ONLY

Regards,
Marie
Jun 25 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.