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;