1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
CREATE OR REPLACE PROCEDURE stockManager IS
CURSOR lesCommandes IS
SELECT ido FROM ordre WHERE ordreState = 'ECT';
CURSOR lignesCommandes IS
SELECT quantity, ido, idProduct FROM ordreline;
BEGIN
FOR cmd IN lesCommandes
LOOP
FOR lignes IN lignesCommandes
LOOP
IF(lignes.quantity < (getStockQuantity(lignes.idproduct))) THEN
UPDATE product set stockQuantity = stockQuantity - lignes.quantity WHERE idprod = lignes.idproduct;
UPDATE ordre set ordreState = 'T';
ELSE
DBMS_OUTPUT.PUT_LINE("stock insuffisant");
END IF;
END LOOP;
END LOOP;
END;
/ |
Partager