Posted By

wh0emPah on 03/31/10


Tagged


Versions (?)

aezrae


 / Published in: PL/SQL
 

  1. PROCEDURE P2_4_VERLAAGMINSTVERKOCHTE AS
  2. TYPE TYPE_REC_SKI IS RECORD (
  3. PRODUCTID S_INVENTORY.PRODUCT_ID%TYPE,
  4. TOTAL_QUANTITY NUMBER );
  5.  
  6. TYPE type_col_ski IS
  7. TABLE OF type_rec_ski INDEX BY PLS_INTEGER;
  8. t_ski type_col_ski;
  9. SELECT i.product_id, SUM(i.quantity) quantity
  10. FROM s_item i, s_product p
  11. WHERE i.product_id = p.id AND p.name LIKE '%Ski%'
  12. GROUP BY i.product_id
  13. ORDER BY quantity ASC;
  14.  
  15. FOR i IN 1..t_ski.COUNT
  16. DBMS_OUTPUT.PUT_LINE (t_ski(i).productid || ' ' || t_ski(i).total_quantity);
  17. UPDATE S_INVENTORY
  18. SET reorder_point = reorder_point * 0.8, max_in_stock = max_in_stock * 0.8
  19. WHERE product_id = t_ski(i).productid;
  20. EXIT WHEN i = 10;
  21. END P2_4_VERLAAGMINSTVERKOCHTE;

Report this snippet  

You need to login to post a comment.