订货:
订单参数(物品标号,数量)在库存表中找到该物品的数量,若大于订单数量,则库存数减少相应数量,
若小于,则不变。create or replace procedure saledisc(pid in number, amount in number) is
a number;
beginselect quantity into a
from saleonline.disc
where id=pid;if a>amount then
insert into saleonline.disc
values(amount)
where id=pid
endif
end
订单参数(物品标号,数量)在库存表中找到该物品的数量,若大于订单数量,则库存数减少相应数量,
若小于,则不变。create or replace procedure saledisc(pid in number, amount in number) is
a number;
beginselect quantity into a
from saleonline.disc
where id=pid;if a>amount then
insert into saleonline.disc
values(amount)
where id=pid
endif
end
from saleonline.disc
where id=pid;
a number;
beginselect quantity into a
from saleonline.disc
where id=pid;if a>amount then
update saleonline.disc
set quantity=quantity-amount
where id=pid;
endif ;
end;