begin
    score1:=50;
    score2:=60;
  stupro(score1,score2);
end;
放在create or replace ...前面是什么意思?

解决方案 »

  1.   

    错误太多了。
    1。Begin放在Create里面
    2。Procedure不能AS,如果要有返回值,请改成Function。
    你这是生写吗?也不看看语法书再写??
      

  2.   

    create or replace procedure stupro 
    用于创建存储过程,编译时有错误吗?下面是运行存储过程
    begin
        score1:=50;
        score2:=60;
      stupro(score1,score2);
    end;
    存储过程编译如果没有问题,运行时有问题,就把过程贴出来看看。
      

  3.   

    执行过程用exec stupro(50,60);即可
    把你的过程代码贴出来,大家就可以帮你找的原因了
      

  4.   

    to: bowlder(玩石)
     噢!明白了,我试试!谢谢各位!
      

  5.   

    程序处理是根据学生的各项成绩自动归类(合格、不合格)数据表student存放学生成绩,表result存放结果。
    过程:create or replace procedure studpro(temp1 in system.student.yw%type,temp2 in system.student.sx%type,temptotalscore in system.result.totalscore%type) as
                       studentrecord system.student%rowtype;
                       studenttotalscore system.result.totalscore%type;
                       studentflag varcha2(4);
       cursor studentcursor is select * from system.student;
       eorromessage exception;
       begin
         open studentcursor;
         if studentcursor%notfound then
             raise errormessage;
         end if;
         loop
            fetch studentcursor into studentrecord;     
            studenttotalscore:= studentrecord.yw+studentrecord.sx
            if (studentrecord.yw>=temp1 and studentrecord.sx>=temp2) then
                studentflag:='合格';
            else
                studentflag:='不合格';
            end if;
            exit when studentcursor%notfound;
            insert into system.result(bh,xm,lb,yw,sx,totalscore.flag)
            values(studentrecord.bh,studentrecord.xm,studentrecord.lb,studentrecord.yw,studentrecord.sx,studenttotalscore,studentflag);
         end loop;
         close studentcursor;
         commit;
         exception
         when errormessage then
              dbms_output.put_line('无法打开数据表!');
         end;
      

  6.   

    stupro(score1,score2);要三个参数.
      

  7.   

    当然编译有错误啦,参数都没传对,stupro(score1,score2,score3);参数temptotalscore 哪里去了?
      

  8.   

    只打开游标,没有检索值的活动,那studentcursor%notfound 必为null.if studentcursor%notfound then
             raise errormessage;
    end if;
    一定不会发生的.此句是多余。
      

  9.   

    写程序要细心,一眼看出程序中出现微细的小错误。
    studentflag varcha2(4);---此句自怎能定义4字节呢,下面的长度就不够长度了,而且把varchar2(4)写错了。唉!SQL> set serveroutput on
    SQL> declare
      2  a varchar2(4):='不合格';
      3  begin
      4  dbms_output.put_line(a);
      5  end;
      6  /
    ORA-06502: PL/SQL: 数字或值错误 :  字符串缓冲区太小
    ORA-06512: 在line 2修改如下
    studentflag varchar2(6);