我想做这样的事情:
Quantity Price Payment
1 12 12.00
这是我的代码:
CREATE DEFINER=`root`@`localhost`
PROCEDURE `insertproducts`
(
pname varchar(50),
pdesc varchar(50),
psupp varchar(50),
pdate date,
pquant int,
pprice double
)
begin
insert into products
(
prodname,
proddescription,
prodsupplier,
proddate,
prodquantity,
prodprice,
prodpayment
)
values
(
pname,
pdesc,
psupp,
pdate,
pquant,
pprice,
ppayment
)
set prodpayment = pprice * prodquantity;
end
这不起作用,任何想法?
答案 0 :(得分:3)
什么是ppayment
?您可以直接乘以参数
insert into products
(
prodname,
proddescription,
prodsupplier,
proddate,
prodquantity,
prodprice,
prodpayment
)
values
(
pname,
pdesc,
psupp,
pdate,
pquant,
pprice,
pprice*prodquantity
)