Posted By

wh0emPah on 04/01/10


Tagged


Versions (?)

azeae


 / Published in: PL/SQL
 

  1. CREATE OR REPLACE PROCEDURE P3_1_HHOGSTE_VOORRAADWAARDE AS
  2. CURSOR C_WAREHOUSE IS
  3. SELECT WAREHOUSE_ID, SUM(I.AMOUNT_IN_STOCK * P.SUGGESTED_WHLSL_PRICE) Waarde
  4. FROM S_INVENTORY I, S_PRODUCT P
  5. WHERE I.PRODUCT_ID = P.ID
  6. GROUP BY WAREHOUSE_ID
  7. ORDER BY WAARDE DESC;
  8.  
  9. R_WAREHOUSE C_WAREHOUSE%ROWTYPE;
  10. OPEN C_WAREHOUSE;
  11. FOR I IN 1..3 LOOP
  12. FETCH C_WAREHOUSE INTO R_WAREHOUSE;
  13. IF C_WAREHOUSE%NOTFOUND THEN
  14. DBMS_OUTPUT.PUT_LINE(R_WAREHOUSE.WAREHOUSE_ID || CHR(9) || R_WAREHOUSE.Waarde);
  15. CLOSE C_WAREHOUSE;
  16. END P3_1_HHOGSTE_VOORRAADWAARDE;

Report this snippet  

You need to login to post a comment.