collection & update complexe
Bonjour,
j'ai des updates (multiples) a faire sur une table, et je me sers d'une table (Record) pour stocker temporairement mes updates avant de faire un forall (il s'agit de centaines de milliers de lignes a updater)
je ne trouve pas de solution pour éviter l'erreur PLS-00436, sachant que mon update est un peu complexes, il s'agit de 49 champs à mettre à jour. Il y a aussi le fait que la requête de la loop qui sert a parcourir en premier lieu n'a pas la même structure (la collection listeClientRow )
Code:
1 2 3 4 5 6 7
|
TYPE clientRow IS TABLE OF CLIENT_O%ROWTYPE;
listeClientRow clientRow;
TYPE clientUpd IS RECORD (champ1, .....);
TYPE clientUpdRow IS TABLE OF clientUpd;
listeUpdClientRow clientUpdRow; |
Code:
1 2 3 4 5
|
reqUpdat:='UPDATE CLIENTS ';
reqUpdat:=reqUpdat || 'SET ';
reqUpdat:=reqUpdat || 'champ1=:1, champ2 =:2,';
.... |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
LOOP
FETCH clientCur BULK COLLECT INTO listeClientRow LIMIT NBMAXCOMMIT;
EXIT WHEN listeClientRow.count=0;
listeUpdClientRow := clientUpdRow();
FOR i in listeClientRow.first.. listeClientRow.last
LOOP
IF ******
nbUpdat:=nbUpdat + 1;
listeUpdClientRow.extend(1);
listeUpdClientRow(nbUpdat).champ1:= listeClientRow(i).champ1 ;
listeUpdClientRow(nbUpdat).champ2 := listeClientRow(i).champ2 ;
....
END IF;
END LOOP;
forall i in listeUpdClientRow.first..listeUpdClientRow.last
***reqUpdat---using listeUpdClientRow(i).champ1, ....
END LOOP; |
Merci d'avance