Advertisement
Guest User

Untitled

a guest
May 25th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. drop procedure if exists genererMouvement;
  2. delimiter //
  3. create procedure genererMouvement(_idCmd int(5))
  4. begin
  5. declare fin int default 0;
  6. declare _idLigne int ;
  7. declare _qtc int;
  8. declare cursorMouv cursor for
  9. select idLigne, qtc from lignesCmd where idCmd=_idCmd;
  10. declare continue handler
  11. for not found set fin = 1;
  12. open cursorMouv;
  13. Fetch cursorMouv into _idLigne, _qtc ;
  14.  
  15. while fin != 1
  16. do
  17. insert into mouv values (
  18. null,
  19. _idLigne,
  20. curdate(),
  21. 's',
  22. _qtc
  23. );
  24. Fetch cursorMouv into _idLigne, _qtc ;
  25. end while;
  26. close cursorMouv;
  27. end //
  28. delimiter ;
  29.  
  30.  
  31. insert into articles values (
  32. null,
  33. _idTVA,
  34. _codeArt,
  35. _libelle,
  36. _qteStock,
  37. _pubv,
  38. _pua,
  39. _dureeAppro,
  40. _qteAlerteStock
  41. );
  42. end if ;
  43. end //
  44. delimiter ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement