MySQL Forums
Forum List  »  Stored Procedures

Creating a stored procedure that indicates if a product is in stock.
Posted by: Josef Lundström
Date: September 02, 2017 04:31AM

I have a stored procedure that makes it possible to change the status of a product in a warehouse from "available" to "unavailable". The problem is, that it's not possible to change the status back to "available" if the product is back in stock.


DELIMITER //
CREATE PROCEDURE UpdateBooks(IN varbook VARCHAR(50), IN varStatus VARCHAR(50))
BEGIN
DECLARE status VARCHAR(50) DEFAULT 'available';
IF varStatus <> status THEN
UPDATE book SET bookStatus = varStatus WHERE bookTitle = varbook;
END IF;
END //


How do I do this?

Options: ReplyQuote


Subject
Views
Written By
Posted
Creating a stored procedure that indicates if a product is in stock.
3511
September 02, 2017 04:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.