DELIMITER // CREATE PROCEDURE GetCustomerLevel( IN pCustomerNumber INT, OUT pCustomerLevel VARCHAR(20)) BEGIN DECLARE credit DECIMAL DEFAULT 0; SELECT creditLimit INTO credit FROM customers WHERE customerNumber = pCustomerNumber; IF credit > 50000 THEN SET pCustomerLevel = 'PLATINUM'; ELSEIF credit > 10000 AND credit <= 50000 THEN SET pCustomerLevel = 'GOLD'; ELSE SET pCustomerLevel = 'SILVER'; END IF; END // DELIMITER ; CALL GetCustomerLevel(447, @level); SELECT @level As Customer_Type;