Skip to content

Instantly share code, notes, and snippets.

@prashant4224
Created May 31, 2020 17:09
Show Gist options
  • Save prashant4224/519d70f567480d6672f241f31d07b4ea to your computer and use it in GitHub Desktop.
Save prashant4224/519d70f567480d6672f241f31d07b4ea to your computer and use it in GitHub Desktop.
DELIMITER $$
CREATE PROCEDURE GetCustomerLevel(
IN pCustomerNumber INT,
OUT pCustomerLevel VARCHAR(20))
BEGIN
DECLARE credit DECIMAL(10,2) DEFAULT 0;
SELECT creditLimit
INTO credit
FROM customers
WHERE customerNumber = pCustomerNumber;
IF credit > 50000 THEN
SET pCustomerLevel = 'PLATINUM';
END IF;
END$$
DELIMITER ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment