Created
July 12, 2020 04:39
-
-
Save mikelemus27/a5e7467e41c25f869eb7027f98423ba9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS operacionesif; | |
DELIMITER // | |
CREATE FUNCTION operacionesif(op INT, num1 INT, num2 INT) | |
RETURNS VARCHAR(255) DETERMINISTIC | |
BEGIN | |
IF op=1 THEN | |
RETURN CONCAT(num1,' + ',num2,' = ',num1+num2); | |
ELSEIF op=2 THEN | |
RETURN CONCAT(num1,' - ',num2,' = ',num1-num2); | |
ELSEIF op=3 THEN | |
RETURN CONCAT(num1,' * ',num2,' = ',num1*num2); | |
ELSEIF op=4 THEN | |
RETURN CONCAT(num1,' / ',num2,' = ',num1/num2); | |
ELSE | |
RETURN 'ERROR: La operacion que ha solicitado no existe'; | |
END IF; | |
END; // | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment