程序设计题 (20分)
某一库存管理数据库,有数据表:
实时库存量表xa,表结构(编号/ c/ 5,品名/ c/ 10,库存量/ n/ 6);
入库和出库单据表xb,表结构(编号/ c/ 5,标志/ L/ 1,数量/ n/ 5)。
其中,xb中的标志字段为“真”时代表入库,为“假”时代表出库。
试编写程序,根据xb表的数据,更新xa表的实时库存量。具体算法是,如果标志字段为“真”,将数量增加到xa对应的商品库存量;如果标志字段为“假”,从xa对应的商品库存量中减去数量。
set talk off
select 1
USE xb
select 2
use xa
index on 编号 to ibh
select 1
set rela TO 编号 INTO B
go top
do while .not.eof(1)
sele 2
if .not.eof(2)
if A->标志
repl 库存量 with 库存量+a->数量
else
repl 库存量 with 库存量-a->数量
endif
endif
SELE 1
skip
enddo
close all
retu