next up previous contents
Next: 6 Gestion des exceptions Up: 5 Curseur : Previous: 5.7 Boucles FOR LOOP   Contents

5.8 Curseur paramétré

Syntaxe: CURSOR nom_curseur ( param_1 type_1, param_2 type_2, ... ) IS

                 SELECT ....
         OPEN nom_curseur ( valeur_1, valeur_2, ... );
Ex : DECLARE

     CURSOR c_personne (tranche NUMBER) IS
            SELECT nom, prnm, trtmnt
            FROM personnel
            WHERE TRUNC(trtmnt,-3) > tranche;

    BEGIN
     FOR p IN c_personne (15000)
     LOOP
         INSERT INTO traitement VALUES( p.nom,p.prnm,p.trtmnt ) ;
     END LOOP;
    END;


Florence Bannay 2000-11-13