plsql - pl sql: trigger for insert data from another table -


there table old , similar one, new. want insert in existing process fills table old trigger event each new inserted row, event insert newly inserted row table new, well. inside body of trigger, need include query below aggregates values of old before inserted in new:

insert new   select (select a.id,a.name,a.address,b.jitter,a.packet,a.compo,b.rtd,a.dur old a,         select address,packet,compo, avg(jitter) jitter, avg(rtd) rtd old         group address,packet,compo ) b         a.address=b.address , a.packet=b.packet , a.compo=b.compo; 

can correct possible mistakes or suggest other trigger syntax on statement below?

create or replace trigger insertion after update on old each row begin select query above end;

in each row trigger cannot query table itself. mutating table error message if do. recommend use triggers basic functionality such handing out id numbers , basic checks. if use triggers more complex tasks may end system that's hard debug , maintain because of kinds of actions appear out of knowhere.

look @ question approach: getting rid of insert trigger


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -