你这么改试试create or replace procedure stuprocess(
tempp in stu.p%type,
tempe in stu.e%type,
tempm1 in stu.m1%type,
tempm2 in stu.m2%type,
tempm3 in stu.m3%type,
tempsum in result.sum%type)assturecord stu%rowtype;
stusum    result.sum%type;
stuflag    varchar2(4);
cursor stucursor is select * from stu;errmessage  exception;begin 
open stucursor;
 
loop
  fetch stucursor into sturecord;
 if stucursor%notfound then 
    raise errmessage;
 endif;
  stusum:=sturecord.e+sturecord.p+sturecord.m1+sturecord.m2+sturecord.m3
  if (sturecord.e>=tempe    and
     sturecord.p>=tempp    and
     sturecord.m1>=tempm1  and
     sturecord.m2>=tempm2  and
     sturecord.m3>=tempm3  and
     stusum>=tempsum)      then
    stuflag:="录取";
    else
    stuflag:="落选";
  endif;
exit when stucursor%notfound;
insert into result values(sturecord.bh,sturecord.xm,sturecord.lb,sturecord.e,sturecord.p,sturecord.m1,sturecord.m2,sturecord.m3,stusum,stuflag);
  end loop;
close stucursor;
commit;
exception  when errmessage then 
     dbms_output.putline("can not open the table");end;   

解决方案 »

  1.   

    create or replace procedure stuprocess(
    tempp in stu.p%type,
    tempe in stu.e%type,
    tempm1 in stu.m1%type,
    tempm2 in stu.m2%type,
    tempm3 in stu.m3%type,
    tempsum in result.sum%type)
    as
    sturecord stu%rowtype;
    stusum    result.sum%type;
    stuflag    varchar2(4);
    cursor stucursor is select * from stu;begin 
    open stucursor;
     
    loop
      fetch stucursor into sturecord;
      exit when stucursor%notfound;
      stusum:=sturecord.e+sturecord.p+sturecord.m1+sturecord.m2+sturecord.m3
      if (sturecord.e>=tempe)    and
         (sturecord.p>=tempp)    and
         (sturecord.m1>=tempm1)  and
         (sturecord.m2>=tempm2)  and
         (sturecord.m3>=tempm3)  and
         (stusum>=tempsum)      then
        stuflag:="录取";
      else
        stuflag:="落选";
      end if;
    insert into result values(sturecord.bh,sturecord.xm,sturecord.lb,sturecord.e,sturecord.p,sturecord.m1,sturecord.m2,sturecord.m3,stusum,stuflag);
    end loop;
    close stucursor;
    commit;
    exception  
    when others then 
    dbms_output.putline("can not open the table");end;   
      

  2.   

    我想是不是传入参数和你在过程中定义的变量没有分别写的缘故阿
    把传入变量写在括号里,as 你的变量.
    create or replace procedure proc
    (
    vari1       char(6),
    vari2       number(12)
    )
    as
    yourvari1   char(6);
    yourvari    number(12);
    ......
    ......
    ......