小弟新手,写了个存储过程,但总有错,请大家帮忙改下,
万分感谢!!!
(postid in number,somid in char(14),
balancemoney out number)
as
somid_c number;
counter number;
begin
select childcount into conuter from system.hr_gatheringbill where somid=somid;
if (counter>0) then
select balancemoney from system.hr_gatheringregion
where postid in
( select max(postid)
from system.hr_gatheringregion
); ---输出balancemoney值
else (counter=0)
begin
select count(somid) into somid_c from system.hr_gatheringregion
where somid=somid;
if (somid_c=1) then
select balancemoney from system.hr_gatheringregion
where primaryid=(select somid from system.hr_gatheringbill
where createtime in
( select max(createtime)
from system.hr_gatheringbill
)
); ---输出balancemoney值
else (somid_c=0)
balancemoney=0; ---输出balancemoney=0
end if;
end;
end if;
end;
万分感谢!!!
(postid in number,somid in char(14),
balancemoney out number)
as
somid_c number;
counter number;
begin
select childcount into conuter from system.hr_gatheringbill where somid=somid;
if (counter>0) then
select balancemoney from system.hr_gatheringregion
where postid in
( select max(postid)
from system.hr_gatheringregion
); ---输出balancemoney值
else (counter=0)
begin
select count(somid) into somid_c from system.hr_gatheringregion
where somid=somid;
if (somid_c=1) then
select balancemoney from system.hr_gatheringregion
where primaryid=(select somid from system.hr_gatheringbill
where createtime in
( select max(createtime)
from system.hr_gatheringbill
)
); ---输出balancemoney值
else (somid_c=0)
balancemoney=0; ---输出balancemoney=0
end if;
end;
end if;
end;
解决方案 »
- 急:为什么在当前用户下创建另一个用户正常,可是赋予权限的时候会报错:ORA=00990
- HP-UX 11v2上Oracle 10g使用OCCI进行Clob字段的插入时线程被阻塞
- 求教一个语句!!!!
- 10g登录为什么总提示用户名或密码无效?
- 怎样删除重复的记录
- 在PL/SQL的查询结果(中文字)粘到文本文档或EXCEL里会变成乱码?
- Oracle数据库中如何使字段自动加密 , 如同sys.user$下的password字段為16进制数一样 ?
- clob和blob的问题请教。
- 如何更改好多表中共同拥有的同一字段的长度,因为一个一个改太麻烦,请大侠赐教!
- 如何更改表空间
- PL/SQL中,主函数中使用BEGIN...EXCEPTION...END模块的效率问题。听听大家的意见
- 如何给时间字段增加15分钟?
变量名称不要跟字段名称冲突!
else (counter=0)换成elsif(counter=0)试试
------------------
这是永真式 应该查出多条记录,这时select into 会抛异常