I am writing stored function first time, I have written below code, I googled if I made synthetic problem, but did not find any solution, can you please, help me
CREATE FUNCTION GetOrderTotalAmountTesting(order_id int) RETURNS decimal(10,2) BEGIN declare order_amount_total decimal(10,2); SELECT ((sum(calc_unit_price)*quantity)+sum(calc_tax)+sum(shipping_cost)) INTO order_amount_total from order_details det where det.order_id =order_id; RETURN order_amount_total; END
Below are the errors Error SQL query:
CREATE FUNCTION GetOrderTotalAmountTestingassdasd(order_id int)
RETURNS decimal(10,2)
BEGIN
declare order_amount_total decimal(10,2)
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 5