首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

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

2012-05-04 
帮我看看这个存储过程哪错了?create or replace procedure yyp_wbcf(dhhm varchar,cxjg out varchar) isv_

帮我看看这个存储过程哪错了?
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;




[解决办法]
分号忘加了!
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;

热点排行