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

一个简单的过程到底那里有错
CREATE OR REPLACE
procedure UpdateSHGL_CJ(
 i_cjrq in date,
 i_hm in varchar2,
 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 
 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;
 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 if i_hmlb='2' then --2
  if total1>=F2 then--2.1
  if total1 >= G2 then--2.1.1
  i_hmcj:=(H2+I2)*total1;
  i_sbcj:=S2*total1;
  else 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;  
  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;
  else 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; 
  if total1<F1 then--2.3
  i_hmcj:=H2 * total1;
  i_sbcj:=S2*total1;
  end if;--end2.3
end if;
 --------------------------
if i_dlsbh=i_sbdls then--3
  i_yfcj:=i_hmcj+i_sbcj;
else if i_dlsbh !=i_sbdls then
  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;
显示where有错,可是好象没啊,是不是if有错?????
十分感谢!!!!老大让我写,从前没写过oracle方面的,也不知道怎么调试.谢谢


------解决方案--------------------
第一,where 最后那个分号是全角 

第二,那堆 if .. else if 的begin..end不全 
if total1> =F2 then 没有对应的end if 


第三,那个“哪里错了哪里错了”快结贴给分....