473,387 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
0 2477

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

Similar topics

2
by: Trevor Fairchild | last post by:
I am trying to create a very minimal auditing system for a series of databases. I am in the process of writing Update triggers for 5 Tablse. I will write a trigger for each table-the trigger's...
10
by: Lauren Quantrell | last post by:
I have never written a trigger before and now am seeing the light. Is there a way to write a trigger so that if a user changes any column in a single row on one table then the trigger will write...
4
by: My SQL | last post by:
Hi Can I trigger an external program to run when a new record is added to the mysql table? The external program is in C and instead of scanning the table continuously for new insertions, it...
2
by: mghale | last post by:
Hello, I have to create a trigger to accomplish the following: Before the insert into table A occurs, the trigger must check to see if the combination of two columns (from the insert...
9
by: steven | last post by:
Does anyone know how to do the following. I'm trying to mimic replication with triggers. I have 2 databases, each have these 2 tables. 1. USERS ID int NAME varchar(20)
9
by: Ots | last post by:
I'm using SQL 2000, which is integrated with a VB.NET 2003 app. I have an Audit trigger that logs changes to tables. I want to apply this trigger to many different tables. It's the same trigger,...
8
by: candide_sh | last post by:
hello, I googled around some time but I found no solution for this issue (SS2000). I have a table tblB which has to be filled whenever in table tblA records are inserted, updated or deleted....
6
by: Oliver | last post by:
I'm fairly new to DB2. I have been assigned to build a delete trigger that finds the data type of each of the table's fields so that the trigger can then build a string consisting of OLD values...
3
by: lenygold via DBMonster.com | last post by:
Thank you very much SERGE for your help. I found example in Graeme Birchall COOKBOOK wich i think exactly what i need for SQL check in triggers: • User query joins to table function - sends...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.