Trigger qui insert dans une nouvelle table le contenu d'un select
Je suis en train d'écrire un trigger qui va inserer dans une autre table le contenu d'un select. Mais je n'arrive pas à terminer mon trigger car je ne sais pas lire les données dans le cursor. Bref je suis débutant en PLSQL.
Voici le bout de code que j'ai commencé :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| create or replace trigger insert_table1
before insert on table1 for each row
declare
cursor c1 is
select r.tab_y, r.tab_b, r.tab_s, r.tab_n, r.tab_d, s.tab_r_s, s.tab_r_n, s.tab_r_d, s.tab_r_cons, i.tab_hs_c||i.tab_hsp_c as tar
from table1 r, sadg s, sadi i
where r.ky = s.ky and
r.kc = s.kc and
r.kd = s.kd and
r.kn = s.kn and
r.ky = i.ky and
r.kc = i.kc and
r.kd = i.kd and
r.kn = i.kn and
i.tab_hs_c||i.tab_hsp_c= '239100';
donneC1 c1%rowtype;
begin
open c1;
FETCH c1 INTO donneC1;
while c1%found loop
insert into attestcmp values ( ?????????????????????????)
...
...
... |