Pascal LAFOURCADE 4 years ago
parent c5b3608b84
commit feb9f42f0a

@ -1464,7 +1464,103 @@ END;
\begin{exercice} Afficher les produits qui nont pas de fournisseur et les produits qui en ont avec les noms de leurs fournisseurs.
\end{exercice}
\cache{TODO}
\cache{
SET echo OFF
SET verify OFF
SET feed OFF
DROP TABLE tligne;
CREATE TABLE Tligne(ligne VARCHAR2(200));
DROP TABLE tligne2;
CREATE TABLE Tligne2(ligne VARCHAR2(200));
DECLARE
DnoProduit tProduit.noProduit\%TYPE;
Ddesignation tProduit.designation\%TYPE;
Dstock tProduit.stock\%TYPE;
Dref tFournisseur.ref\%TYPE;
DlistFourn VARCHAR(1000);
CURSOR r IS SELECT noProduit,designation,stock FROM tProduit WHERE noProduit NOT IN (SELECT noProduit FROM tProduitFourn);
CURSOR t IS SELECT noProduit,designation,stock FROM tProduit;
CURSOR s IS SELECT ref FROM tProduitFourn WHERE noProduit = DnoProduit;
BEGIN
OPEN r;
INSERT INTO Tligne VALUES('noProduit designation stock');
FETCH r INTO DnoProduit,Ddesignation,Dstock;
WHILE r\%FOUND
LOOP
INSERT INTO Tligne VALUES(DnoProduit||' '||Ddesignation||' '||Dstock);
FETCH r INTO DnoProduit,Ddesignation,Dstock;
END LOOP;
CLOSE r;
OPEN t;
INSERT INTO Tligne2 VALUES('noProduit designation stock reference fournisseur');
FETCH t INTO DnoProduit,Ddesignation,Dstock;
WHILE t\%FOUND
LOOP
DlistFourn :='';
OPEN s;
FETCH s INTO Dref;
WHILE s\%FOUND
LOOP
DlistFourn := DlistFourn||' '||Dref;
FETCH s INTO Dref;
END LOOP;
CLOSE s;
INSERT INTO Tligne2 VALUES(DnoProduit||' '||Ddesignation||' '||Dstock||' '||DlistFourn);
FETCH t INTO DnoProduit,Ddesignation,Dstock;
END LOOP;
CLOSE t;
END;
.
/
SELECT * FROM Tligne;
SELECT * FROM Tligne2;
SET echo ON
SET verify ON
SET feed ON
}
\subsection{\code{UPDATE, DELETE ... WHERE CURRENT OF curseur}}
Lors du parcours d'une table (ou une vue modifiable) par \code{FETCH}

Loading…
Cancel
Save