student表里面有3条数据
sno sname pno
1   test  1
2   test2 2
3   test3 3
create or replace procedure stu_proc1(pno in student.sno%type) as
pname varchar2(25);
begin
  select sname into pname from student where sno=pno;
  dbms_output.put_line(pname);
end;然后调用存储过程:
call stu_proc1(2);
后会报说:实际返回的行数超出请求的行数

解决方案 »

  1.   

    select sname into pname from student where sno=pno;执行这行查出来多条记录
      

  2.   


    stu_proc1(pno in student.sno%type)这个是啥意思啊
      

  3.   

    stu_proc1(pno in student.sno%type)
    是不是pno这个参数的数据类型和大小和sno字段的一样?
      

  4.   

    你的参数名称与字段名称相同,产生了歧义。create or replace procedure stu_proc1(v_pno in student.sno%type) as
    pname varchar2(25);
    begin
      select sname into pname from student where sno=v_pno;
      dbms_output.put_line(pname);
    end;
      

  5.   

    pno in student.sno%type
    这个参数和基表student中pno同名,引起错误。
      

  6.   

    用for循环
    for i in 10 loop
    call stu_proc1(2);
    end loop;这样就可以了!