帮我看看这个存储过程哪错了?

孙月魂 2012-05-02 11:36:36
create or replace procedure yyp_wbcf(dhhm varchar,cxjg out varchar) is
v_count number;
name varchar(20);
qf number;
begin
select count(*) into v_count from yxv_csy where YX_SJ=dhhm;
if v_count=0 then
select count(*) into v_count from yxv_csy where yx_lxdh=dhhm;
if v_count=1 then
select yx_yfmc into name from yxv_csy where yx_lxdh=dhhm;
select qf_ze into qf from yxv_csy_yjsfze where yx_lxdh=dhhm;
cxjg := '';
else
select sum(qf_ze) into qf from yxv_csy where yx_sj=dhhm;
cxjg := '';
end if
else
if v_count=1 then
select yx_yfmc into name from yxv_csy where yx_sj=dhhm;
select qf_ze into qf from yxv_csy where yx_sj=dhhm;
cxjg := '';
else
select sum(qf_ze) into qf from yxv_csy where yx_sj=dhhm;
cxjg := '';
end if
end if;
end yyp_wbcf;

报这个错:
Compilation errors for PROCEDURE YX_GLXT.YYP_WBCF

Error: PLS-00103: Encountered the symbol "ELSE" when expecting one of the following:

;
The symbol ";" was substituted for "ELSE" to continue.
Line: 19
Text: else

Error: PLS-00103: Encountered the symbol "END" when expecting one of the following:

;
The symbol ";" was substituted for "END" to continue.
Line: 30
Text: end if;


...全文
66 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
lixin5678 2012-05-02
  • 打赏
  • 举报
回复
分号忘加了!
create or replace procedure yyp_wbcf(dhhm varchar,cxjg out varchar) is
v_count number;
name varchar(20);
qf number;
begin
select count(*) into v_count from yxv_csy where YX_SJ=dhhm;
if v_count=0 then
select count(*) into v_count from yxv_csy where yx_lxdh=dhhm;
if v_count=1 then
select yx_yfmc into name from yxv_csy where yx_lxdh=dhhm;
select qf_ze into qf from yxv_csy_yjsfze where yx_lxdh=dhhm;
cxjg := '';
else
select sum(qf_ze) into qf from yxv_csy where yx_sj=dhhm;
cxjg := '';
end if;
else
if v_count=1 then
select yx_yfmc into name from yxv_csy where yx_sj=dhhm;
select qf_ze into qf from yxv_csy where yx_sj=dhhm;
cxjg := '';
else
select sum(qf_ze) into qf from yxv_csy where yx_sj=dhhm;
cxjg := '';
end if;
end if;
end yyp_wbcf;

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧