mercredi 29 janvier 2020

MySQL Else If Statement not Executing

No matter what MySQL PROCEDURE I create, the 2nd ELSE IF statement returns zero results. Each Select statement when ran separately returns a result. I don't see an issue with my syntax. I apologize if it is a simple fix. Please help.

  DELIMITER $$

CREATE PROCEDURE TEST(type VARCHAR(7), cat TINYINT)
BEGIN
    IF type = 'coffee' THEN
        Select * FROM specific_coffee WHERE id=cat;
    ELSEIF type = 'goodies' THEN
        Select * FROM non_coffee_products WHERE id=cat;
    END IF;
END $$

Aucun commentaire:

Enregistrer un commentaire