This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
-- Exercice 2
-- Afficher le numéro du véhicule loué par un client dont le numéro sera saisi.
-- Cas d’erreur :
-- - « aucune location pour ce client »
-- - « plusieurs locations en cours pour ce client »
-- (nous verrons dans un prochain TP comment traiter ce problème)
-- Test C001, C002, C003 :
-- plusieurs locations pour C001
-- vehicule VE003 est loue par C002
-- aucune location pour C003
DROPTABLEtligne;
CREATETABLEtligne(lignevarchar2(100));
setechooff;
setverifyoff;
setfeedoff;
variablevnoclientchar(4)
promptEntrerlenumeroduclient:
acceptvnoclient
declare
dnovehiculechar(5);
BEGIN
selectnovehintodnovehicule
fromTlocation2017
wherenoclient='&vnoclient';
Insertintotlignevalues('vehicule '||dnovehicule||' est loue par '||'&vnoclient');
exception
whenno_data_foundthen
insertintotlignevalues('aucune location pour '||'&vnoclient');
whentoo_many_rowsthen
insertintotlignevalues('plusieurs locations pour '||'&vnoclient');