level 5
蛋蛋love忧桑
楼主
create procedure one @商品号 int,
@年份 date ,
@利润 int output
as
begin
declare
@销售数量 int,@销售单价 int,@单价 int
select @单价=单价 from 商品表 where @商品号=商品号;
select @销售单价=销售单价, @销售数量=销售数量 from 销售表 where @商品号=商品号 and @年份=销售时间
end
if @单价 is null
rollback;
return;
if @销售单价 is null
rollback;
return;
set @利润=@销售数量*(@销售单价-@单价)
go
2017年02月14日 02点02分
1
@年份 date ,
@利润 int output
as
begin
declare
@销售数量 int,@销售单价 int,@单价 int
select @单价=单价 from 商品表 where @商品号=商品号;
select @销售单价=销售单价, @销售数量=销售数量 from 销售表 where @商品号=商品号 and @年份=销售时间
end
if @单价 is null
rollback;
return;
if @销售单价 is null
rollback;
return;
set @利润=@销售数量*(@销售单价-@单价)
go