salut tout le monde,
j'ai un problème avec ma procédure stocké elle n'affecte pas mes valeur et elle me fait 2 warning
le sujet que je doit faire c'est le fameux magasin de location de DVD's ^^ le sujet pas barbant des profs d'infos.
cette procédure me permet de faire le retour d'un DVD, elle update le champs location.date_de_fin et le solde du client client.solde
j'ai deja essaye de simplifier mais rien y fait ca ne marche pas
DELIMITER $
DROP PROCEDURE retourclient$
CREATE PROCEDURE retourclient(IN vid_client INT, IN vid_location INT)
BEGIN
DECLARE id_client INT;
DECLARE vdate_de_debut DATE;
DECLARE vduree_loc INT;
DECLARE vsoldeasous INT;
DECLARE vid_location INT;
DECLARE vsolde INT;
DECLARE TAUXJ INT;
--SELECT id_client INTO vid_client FROM client
--WHERE nom=vnom;
set @TAUXj = 2;
--set @vid_client = id_client from client WHERE nom=vnom;
--SELECT id_location INTO vid_location
--FROM client left outer join location
--ON vid_client = location.id_client WHERE location.date_de_fin is NULL;
--set @vid_location = id_location from client left outer join location on vid_client = location.id_client where location.date_de_fin is null;
SELECT date_de_debut INTO vdate_de_debut
from location where id_location = vid_location;
SELECT timestampdiff(day,vdate_de_debut,CURRENT_DATE) INTO vduree_loc;
SELECT vduree_loc * @TAUXJ INTO vsoldeasous;
UPDATE location set date_de_fin=CURRENT_DATE WHERE id_location = vid_location;
SELECT solde INTO vsolde FROM client
WHERE id_client=vid_client;
SELECT vsolde - vsoldeasous INTO vsolde ;
UPDATE client set solde = vsolde where id_client=id_client;
END;
$