尝试通过存储过程将多个值插入到我的表中,唯一的问题是我的语法在某处出错了。 ItemsOrdered表也由一个复合键组成,因此它可以有X个项目进入其中,其中有序表有一组值。 谢谢,这是我到目前为止:
create procedure pr_AddOrder
(
IN OrderNo int,
IN CustId int,
IN EmployeeId int,
IN TransactionId int,
IN Cost int,
IN DateOrdered DATE,
IN DeliveryReq VARCHAR(80)
)
BEGIN
INSERT INTO Ordered
(OrderNo, CustId, EmployeeId, TransactionId, Cost, DateOrdered, DeliveryReq )
VALUES (@OrderNo, @CustId, @EmployeeId, @TransactionId, @Cost, @DateOrdered, @DeliveryReq)
INSERT INTO ItemsOrdered
(OrderNo, MenuItemId, Quantity)
VALUES (@OrderNo, MenuItemId, Quantity)
END