Skip to content

Instantly share code, notes, and snippets.

@mikelemus27
Created July 10, 2020 05:02
Show Gist options
  • Select an option

  • Save mikelemus27/03f643de8b08bd156df2f63276637a09 to your computer and use it in GitHub Desktop.

Select an option

Save mikelemus27/03f643de8b08bd156df2f63276637a09 to your computer and use it in GitHub Desktop.
CREATE PROCEDURE SP_COMPARE(a INT, b INT)
BEGIN
DECLARE message VARCHAR(100) DEFAULT "";
IF a > b THEN
SET message = CONCAT("The first parameter is greater than the second parameter.", a, ">", b);
ELSEIF a < b THEN
SET message = CONCAT("The first parameter is less than the second parameter.", a, "<", b);
ELSE
SET message = CONCAT("Values of both parameters are the same.", a, "=", b);
END IF;
SELECT message AS "Message";
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment