Posted By

wh0emPah on 04/01/10


Tagged


Versions (?)

jljl


 / Published in: PL/SQL
 

  1. CREATE OR REPLACE PROCEDURE P3_6_LAGER_DAN_GEMIDDELD AS
  2. V_GEM_IN_STOCK NUMBER;
  3.  
  4. CURSOR C_PRODUCTS(P_AVG IN NUMBER) IS
  5. SELECT WAREHOUSE_ID, PRODUCT_ID, (SELECT NAME FROM S_PRODUCT WHERE ID=PRODUCT_ID) NAME
  6. FROM S_INVENTORY
  7. WHERE AMOUNT_IN_STOCK < P_AVG
  8. ORDER BY WAREHOUSE_ID, PRODUCT_ID;
  9.  
  10. SELECT AVG(MAX_IN_STOCK)
  11. INTO V_GEM_IN_STOCK
  12. FROM S_INVENTORY;
  13.  
  14. FOR R_PRODUCT IN C_PRODUCTS(V_GEM_IN_STOCK) LOOP
  15. DBMS_OUTPUT.PUT_LINE(R_PRODUCT.WAREHOUSE_ID || ' ' || R_PRODUCT.PRODUCT_ID || ' ' || R_PRODUCT.NAME);
  16.  
  17. END P3_6_LAGER_DAN_GEMIDDELD;

Report this snippet  

You need to login to post a comment.