Posted By

wh0emPah on 03/28/10


Tagged


Versions (?)

BLABLABLA


 / Published in: PL/SQL
 

  1. CREATE OR REPLACE PROCEDURE P1_3_VOEG_ORDERLIJN_TOE
  2. (
  3. P_ORD_ID IN S_ITEM.ORD_ID%TYPE
  4. , P_PRODUCT_ID IN S_ITEM.PRODUCT_ID%TYPE
  5. , P_PRICE IN S_ITEM.PRICE%TYPE
  6. , P_QUANTITY IN S_ITEM.QUANTITY%TYPE
  7. ) AS
  8. V_ITEM_ID S_ITEM.ITEM_ID%TYPE;
  9. SELECT MAX(ITEM_ID)+1
  10. INTO V_ITEM_ID
  11. FROM S_ITEM
  12. WHERE ORD_ID = P_ORD_ID;
  13.  
  14. IF V_ITEM_ID IS NULL THEN
  15. V_ITEM_ID := 1;
  16.  
  17. INSERT INTO S_ITEM(ORD_ID,ITEM_ID,PRODUCT_ID,PRICE,QUANTITY)
  18. VALUES(P_ORD_ID, V_ITEM_ID, P_PRODUCT_ID, P_PRICE, P_QUANTITY);
  19. DBMS_OUTPUT.PUT_LINE('Orderlijn toegevoegd!');
  20. END P1_3_VOEG_ORDERLIJN_TOE;

Report this snippet  

You need to login to post a comment.