56,677
社区成员
发帖
与我相关
我的任务
分享
--查询所有顾客信息-------------------
create procedure getAllCustomer
begin
select * from Customer;
end
--改变商品的数量---------------------
create proc changeGoodsQuantity
(GoodsID1 varchar(10),quantity int)
begin
declare number int;
set number=(select count(*) from Goods where goodsID=GoodsID1)
update Goods set GoodsQuantity=(number-quantity) where GoodsID=GoodsID1
end
--把购物车中的信息导入到订单中,并且删除购物车信息--------
create proc createForm
(customerID int,totalPrice float)
begin
declare orderID varchar(40)
set orderID=(select carID from ShoppingCar where customerID=customerID)
insert into OrderForm values (orderID,customerID,getdate(),totalPrice)
insert into OrderFormDetails select * from ShoppingCarDetails where carID=orderID
delete from ShoppingCarDetails where carID=orderID
delete from ShoppingCar where carID=orderID
end