Problème procédure Oracle
Bonjour, je viens de créer (enfin bientot j'espere) une procédure qui permet de calculer le montant d'une commande.
je voudrais gérer les exceptions quand la commande passer en paramètre n'éxiste pas mais je bloque un peu.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
create or replace procedure montant_commande (idcomm IN commandes.idcommande%TYPE)
as
aucune_commande exception;
dernier_enregistrement commandes.idcommande%type;
begin
select max(idcommande) into dernier_enregistrement
from commandes;
if idcomm>dernier_enregistrement then
raise aucune_commande;
else
update commandes
set montant = round((select sum(p.prixplat * co.quantite)
from plats p, composer co, commandes c
where c.idcommande = co.idcommande
and p.idplat = co.idplat
and c.idcommande=idcomm))
where idcommande = idcomm;
end if;
when aucune_commande then
dbms_output.put_line(Commande inexistante);
end montant_commande; |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
19/1 PLS-00103: Symbole "WHEN" rencontrÚ Ó la place d'un des symbole
suivants :
( begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<identificateur> <identificateur entre guillemets>
<variable attachÚe (bind variable)> << continue close
current delete fetch lock insert open rollback savepoint set
sql execute commit forall merge pipe purge
Symbole "case" a ÚtÚ substituÚ Ó "WHEN" pour continuer.
20/32 PLS-00103: Symbole "INEXISTANTE" rencontrÚ Ó la place d'un des
LINE/COL ERROR
-------- ---------------------------------------------------------------
symboles suivants :
. ( ) , * @ % & = - + < / > at in is mod remainder not rem =>
<exposant (**)> <> or != or ~= >= <= <> and or like like2
like4 likec as between from using || multiset member
submultiset
Symbole "." a ÚtÚ substituÚ Ó "INEXISTANTE" pour continuer.
21/5 PLS-00103: Symbole "MONTANT_COMMANDE" rencontrÚ Ó la place d'un
des symboles suivants :
case |