1.執行存儲過程ci
CALL productpricing(@pricelow,@pricehigh,@priceaverage);it
2.建立存儲過程存儲過程
CREATE PROCEDURE productpricing()ant
BEGIN參數
SELECT Avg(prod_price) AS priceaverage
FROM products;
END;
使用:
CALL productpricing();
3.刪除存儲過程
DROP PROCEDURE productpricing;
4.使用參數
CREATE PROCEDURE odertotal(IN onumber INT,OUT ototal DECIMAL(8,2))
BEGIN
SELECT Sum(item_price*quantity)
FROM orderitems
WHERE order_num=onumber
INTO ototal
END;
調用:
CALL ordertotal(20005,@total);
顯示
SELECT @total;
5.檢查存儲過程
SHOW PROCEDURE STATUS