要求:每个产品信息表中的库存量=该产品进货的总量-该产品出货的总量,设计一个程序实现输入一产品编号,更新该产品的库存量
declare
v_pid tab_ingoods.pid%type;
V_innum tab_ingoods.innum%type;
V_outnum tab_outgoods.outnum%type;
v_stocks number(12,2);
begin
v_pid:=&pid;
select innum,outnum
into V_innum,V_outnum
from tab_ingoods a,tab_outgoods b
where a.pid=b.pid and a.pid=V_pid;
v_stocks:=V_innum-V_outnum;
update tab_product set stocks=v_stocks where pid=V_pid;
exception
when others then
DBMS_output.put_line(SQLERRM);
end;
但是 当执行后会出现"实际返回的行数超出请求行数"
/
请问怎么样处理?
declare
v_pid tab_ingoods.pid%type;
V_innum tab_ingoods.innum%type;
V_outnum tab_outgoods.outnum%type;
v_stocks number(12,2);
begin
v_pid:=&pid;
select innum,outnum
into V_innum,V_outnum
from tab_ingoods a,tab_outgoods b
where a.pid=b.pid and a.pid=V_pid;
v_stocks:=V_innum-V_outnum;
update tab_product set stocks=v_stocks where pid=V_pid;
exception
when others then
DBMS_output.put_line(SQLERRM);
end;
但是 当执行后会出现"实际返回的行数超出请求行数"
/
请问怎么样处理?
解决方案 »
- 请问为什么我安装的oracle 11g express edition没有可视化工具?
- 实在没折了:RAC安装的最后,执行"Configuration Assistant"失败了啊
- ORA-01693错误
- SQLERROR: ORA-06553: PLS-306: wrong number or types of arguments in call to 'OGC_Y'
- 如何用参数控制执行不同的sql语句(在线等答案)
- 优化sql语句
- 安装多个oracle客户端
- 在DELPHI+ORACLE开发中 遇到的奇怪问题
- 怎样计算数据大小?
- oracle安装?
- 怎么遍历索引为varchar2的集合????????
- oracle赋值给变量出错!!!! 高手们请进!!!!!!!!
select innum,outnum
into V_innum,V_outnum
from tab_ingoods a,tab_outgoods b
where a.pid=b.pid and a.pid=V_pid;
可能这语句不返回唯一结果,但是这个可以看出可能数据库里面的数据有点错误哦,修改如下看看:
select innum,outnum
into V_innum,V_outnum
from tab_ingoods a,tab_outgoods b
where a.pid=b.pid and a.pid=V_pid and rownum<2;
select innum,outnum
from tab_ingoods a,tab_outgoods b
where a.pid=b.pid and a.pid=V_pid;
返回单行。否则,必须使用 cursor... fetch的方式处理。