Guest User

Untitled

a guest
Dec 13th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. CREATE PROCEDURE SEND_ITEMS(
  2. IN i_item_id int(11),
  3. IN i_customer_id VARCHAR(11),
  4. IN i_quantity SMALLINT)
  5. AS
  6. BEGIN
  7. IF(EXISTS(SELECT item_id,customer_id FROM wpcheap_items_selected WHERE (item_id = i_item_id AND customer_id = i_customer_id)))
  8. THEN Update wpcheap_items_selected SET quantity = i_quantity WHERE (item_id = i_item_id AND customer_id = i_customer_id)
  9. ELSE
  10. INSERT INTO wpcheap_items_selected(item_id,customer_id,quantity) VALUES (i_item_id, i_customer_id, i_quantity)
  11. END
  12.  
  13. DROP PROCEDURE IF EXISTS SEND_ITEMS;
  14. DELIMITER |
  15. CREATE PROCEDURE SEND_ITEMS(
  16. IN i_item_id int(11),
  17. IN i_customer_id VARCHAR(11),
  18. IN i_quantity SMALLINT)
  19.  
  20. BEGIN
  21. IF(EXISTS(SELECT item_id,customer_id FROM wpcheap_items_selected WHERE (item_id = i_item_id AND customer_id = i_customer_id)))
  22. THEN Update wpcheap_items_selected SET quantity = i_quantity WHERE (item_id = i_item_id AND customer_id = i_customer_id);
  23. ELSE
  24. INSERT INTO wpcheap_items_selected(item_id,customer_id,quantity) VALUES (i_item_id, i_customer_id, i_quantity);
  25. END IF;
  26. END
  27. |
  28. DELIMITER ;
Add Comment
Please, Sign In to add comment