我有两个表,一个是Sales,第二个是SalesDetails, Sales表将仅添加数据,SalesDetails将添加多次,因此我如何多次调用SalesDetails并且只使用一个过程调用一次调用Sale 请帮我。 谢谢你在高级。
这是我的商店程序
CREATE DEFINER=`root`@`localhost` PROCEDURE `addSalesAndSalesDetails`(
in invoiceno nvarchar(30),
in client_id int,
in p_id int,
in qty int,
in unit_price decimal(18,2),
in total_price decimal(18,2),
in sub_total decimal(18,2),
in gst_per int,
in gst_amt decimal(18,2),
in discount_amt decimal(18,2),
in grand_total decimal(18,2),
in s_date date)
BEGIN
insert into salesDetails values(
default, invoiceno,
client_id, p_id, qty,
unit_price, total_price,
s_date);
insert into sales values(
default, invoiceno, client_id,
sub_total, gst_per, gst_amt,
discount_amt, grand_total,
s_date);
END