i have a table that takes data from another table that data loaded to it every day.
the table contains the currency rate.
i need to build a dbtrigger that returns the rates for all currencies
and in case the rate of one currency was changed i need this last modification to be shown in my table.
i don't know how can i create a dbtrigger,and what shall i write in it.
but the case is
post update+post insert
if :new.curr_rate != ld.curr_rate
insert a new record in the table
if any one can tell me what exactly shall i do,and if any need more details
to make more clear no problem.
create trigger trig1
after insert or update of curr_rate on table1
for each row
if inserting or (:new.curr_rate != :old.curr_rate) then
insert into table2 ( col1, col2, ... ) values ( ... );
Note that I assume 2 tables are involved. However, it isn't clear from your question whether the insert in the trigger is into the same table that the trigger is defined on. If that were the case, you would have to write something more complex, to avoid the mutating table issue and infinite recursion.