diff --git a/COURS/PLSQL.tex b/COURS/PLSQL.tex index 85836e9..11f951d 100644 --- a/COURS/PLSQL.tex +++ b/COURS/PLSQL.tex @@ -1168,6 +1168,53 @@ le message Oracle obtenus à l’issue de \code{SELECT}. Modifiez le programme en remplaçant une des deux exceptions par \code{OTHERS}. \end{exercice} +\cache{ +SET echo OFF +SET verify OFF +SET feed OFF + +DROP TABLE tligne; + +CREATE TABLE Tligne(ligne VARCHAR2(200)); + +variable Vref CHAR(5) + +PROMPT Donner un numero de fournisseur: + +ACCEPT Vref + +declare + +DnoProduit char(5); + +BEGIN + +SELECT noProduit INTO DnoProduit FROM tProduitFourn WHERE ref = '\&Vref'; + +INSERT INTO Tligne VALUES('Le fournisseur'||' \&Vref '||' a un produit :'|| DnoProduit); + +exception + +when no\_data\_found then + +INSERT INTO Tligne VALUES('Le fournisseur n a pas de produit'); + +WHEN too\_many\_rows then + +INSERT INTO Tligne VALUES('Le fournisseur a plusieurs produits'); + +END; + +. + +/ + +SELECT * FROM Tligne; + +SET echo ON +SET verify ON +SET feed ON + } \subsection{Erreur utilisateur : \code{EXCEPTION, RAISE}}