Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE
- CURSOR quant IS
- (
- SELECT QUANTITE
- FROM Commande
- WHERE QUANTITE IS NOT NULL;
- )
- quant_temp NUMBER:=0;
- quant_eval NUMBER:=0;
- quantite NUMBER;
- cpt NUMBER:=0;
- BEGIN
- OPEN quant;
- FETCH quant INTO quant_temp;
- LOOP
- FETCH quant INTO quantite
- EXIT WHEN quant%NOTFOUND;
- quant_val := quant_val + QUANTITE - quant_temp;
- quant_temp := QUANTITE;
- cpt := cpt + 1;
- END LOOP;
- DBMS_OUTPUT.put_line("Totale: "||quant_val/cpt);
- EXCEPTION
- WHEN DATA_NO_FOUND THEN
- DBMS_OUTPUT.put_line("Commande is empty!");
- END;
- /
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement