Bonjour,
j'aimerai savoir si on peut faire plusieur action dans un forall?
actuellement je l'utilise comme ceci mais je trouve cela ridicul puisque je dois reparcourir ma table pour faire d'autre opération :
Actuellement :
mes 2 curseurs :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 PROCEDURE copy_transac_valide IS BEGIN select * BULK COLLECT into transac_array from transac partition (&2) where origin <> 0; forall i in transac_array.first .. transac_array.last insert into purge_transac_tmp VALUES transac_array(i); for rec_t in C_TRANS loop for rec_detail in C_DETAIL(rec_t.trans_id) loop insert into purge_detail_tmp values (rec_detail.TRANS_ID,rec_detail.RECORD_DATE,rec_detail.NAME,rec_detail.TYPE,rec_detail.STRING_VALUE,rec_detail.NUMBER_VALUE,rec_detail.DATE_VALUE); end loop; end loop; commit; END;
Et je voudrais fair un truc du genre :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 CURSOR C_TRANS IS select * from transac partition (&2); CURSOR C_DETAIL(trans NUMBER) IS select * from transac_detail partition (&2) where trans_id = trans;
C'est possible ou je dois laisser tomber le forall et utiliser un for classique et tout mettre dans ma boucle?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 PROCEDURE copy_transac_valide IS BEGIN select * BULK COLLECT into transac_array from transac partition (&2) where origin <> 0; forall i in transac_array.first .. transac_array.last insert into purge_transac_tmp VALUES transac_array(i); for rec_detail in C_DETAIL(transac_array(i).trans_id) loop insert into purge_detail_tmp values (rec_detail.TRANS_ID,rec_detail.RECORD_DATE,rec_detail.NAME,rec_detail.TYPE,rec_detail.STRING_VALUE,rec_detail.NUMBER_VALUE,rec_detail.DATE_VALUE); end loop; commit; END;
Partager