Minnu (4/16/2013)
Hi,Below is the query am using..
create or replace trigger tr_stud
after insert or update or delete
of stud_code , name
on stud
referencing old as old new as new
for each row
begin
update lib set current_date =current_date
where
(select c.lib_id from cst c, stud t
where t.stud_code=c.stud_id);
end;
well you didn't provide anything i can paste into Oracle SQLDeveloperr/TOAD, so all i can do is best-guess at syntax.
your not referencing new; or old: anywhere, and you should have separate logic for when you insert vs when you delete...for example, why would you update the other table to some value if a row was deleted? you know your logic better than me, obviously.
for example, if this trigger is doing insert/update/delete, i'd expect a block of code to determine each action?
BEGIN
IF inserting
THEN
trigger_api.tab1_row_change(p_id => :new.projectid, p_action => 'INSERT');
ELSIF updating
THEN
trigger_api.tab1_row_change(p_id => :new.projectid, p_action => 'UPDATE');
ELSIF deleting
THEN
trigger_api.tab1_row_change(p_id => :old.projectid, p_action => 'DELETE');
END IF;
END;
until you are able to provide the complete table ddls (for all teh tables involved), the compete trigger, and a sample insert/update/delete and finally your expected results for each action, you are still going to have to google for the syntax and get it to work yourself.
Best of luck to you!
Lowell