日期:2014-05-17  浏览次数:20648 次

!!过程那里有错那里有错???
CREATE OR REPLACE
procedure UpdateSHGL_CJ(
 i_cjrq in date,
 i_hm in varchar,
 i_dqbh in number,
 i_hmlb in char,
 i_wxcj in number,
 i_bdhf in number,
 i_bdct in number,
 i_bdgj in number,
 i_yhl in number,
 i_dlsbh_sb in number
)
as
declare 
 h1 number(10,2):=0.49;
 s1 number(10,2):=0.41;
 h2 number(10,2):=0.25;
 s2 number(10,2):=0.25;
 A1 number(10,2):=i_bdhf;
 B1 number(10,2):=i_bdgj;
 C1 number(10,2):=i_bdct;
 D1 number(10,2):=i_yhl;
 F1 int:=100000;
 G1 int:=100;
 I1 number(10,2):=0.05;
 F2 int:=200000;
 G2 int:=100;
 I2 number(10,2):=0.10;
 E1 int:=30;
 E2 int:=60;
 i_yfcj number(10,2):=0.00;
 i_hmcj number(10,2):=0.00;
 i_sbcj number(10,2):=0.00;
 i_dlsbh number:=0;
 i_sbdls number:=0;
 i_hmcj number(10,2);
 i_sbcj number(10,2);
 total1 number(10,2):=A1+B1+C1;
 total2 number(10,2):=i_bdct+(1/(3*B1));
 total3 number(10,2):=(1-D1)*total1;
 begin
---------------------------------------
select sum(dlsbh) into i_dlsbh from SHGL_CJQD where cjrq=i_cjrq;
select sum(dlsbh_sb) into i_sbdls from SHGL_CJQD where cjrq=i_cjrq;
-------------------------------------------
if i_hmlb='1' then
  if (total2 >=E1) then
  i_hmcj:=H1 * total3;
  i_sbcj:=S1* total3;
  end if;
else --2
  if total1>=F2 then--2.1
  if (total1 >= G2) then--2.1.1
  i_hmcj:=(H2+I2)*total1;
  i_sbcj:=S2*total1;
  end if;
  if (total2>=E2 and total<G2) or (i_dls=i_sbdls) then--2.1.2
  i_hmcj:=H2*total1;
  i_sbcj:=S2*total1;
  end if;
  end if;--end2.1
  if total1>=F1 and total1<F2 then--2.2
  if total1 >=G1 then--2.2.1
  i_hmcj:= (H2+I1)*total1;
  i_sbcj:=S2*total1;
  end if;
  if (total2>=E2 and total2<G1)or (i_dls=i_sbdls) then--2.2.2
  i_hmcj:=H2 * total1;
  i_sbcj:=S2*total1;
  end if;
  end if;--end2.2
  if total1<F1 then--2.3
  i_hmcj:=H2*total1;
  i_sbcj:=S2*total1;
  end if;--end2.3
end if;
 --------------------------
if i_dls=i_sbdls then--3
  i_yfcj:=i_hmcj+i_sbcj;
else
  i_yfcj:=i_hmcj;
end if;
 ---------------------------------
 update SHGL_CJQD
 set
  total=total1,
  yfcj=i_yfcj, 
  hmcj=i_hmcj,
  sbcj=i_sbcj
 where hm=i_hm and cjrq=i_cjrq;
 end;
end;
如果多了个begin,if条件怎么很多错误??少了没??但是as那里有错???

------解决方案--------------------
把那个declare 和最后一个end去掉