I am trying to create a function to insert a table information, The order id in auto-implemented from the database and in the end I wanted to return it.
CREATE FUNCTION `New_Order`(
P_Customers_customer_id int(11),
P_Employees_employee_id int(11),
P_Shops_shop_id int(11),
P_total double
) RETURNS int(11)
BEGIN
INSERT INTO `shopsorders`
(`order_id`,
`Customers_customer_id`,
`Employees_employee_id`,
`Shops_shop_id`,
`total`,
`date`)
VALUES
(P_Customers_customer_id,
P_Employees_employee_id,
P_Shops_shop_id,
P_total,
sysdate());
RETURN LAST_INSERT_ID();
END