mysql function ro creat a table code example
Example: mysql function ro creat a table
DELIMITER $$
CREATE PROCEDURE GetCustomerLevel(
IN customerNo INT,
OUT customerLevel VARCHAR(20)
)
BEGIN
DECLARE credit DEC(10,2) DEFAULT 0;
-- get credit limit of a customer
SELECT
creditLimit
INTO credit
FROM customers
WHERE
customerNumber = customerNo;
-- call the function
SET customerLevel = CustomerLevel(credit);
END$$
DELIMITER ;Code language: SQL (Structured Query Language) (sql)