set serveroutput on ;create or replace procedure yanyan_pro (yanyan_name in varchar2) as yanyanid yanyan2.classid%type;begin select yanyan2.classid into yanyanid
from yanyan2 where yanyan2.classname=yanyan_name;
if sql%found then
dbms_output.pur_line(yanyan_name||':');
end if;
for yanyan_cur in (select * from yanyan where classid=yanyanid)
loop
dbms_output.put_line('学号'||yanyan_cur.xh
||'姓名'||yanyan_cur.xm
||'工资'||yanyan_cur.sal);
end loop;
exception
when no_date_found then
dbms_output.put_line('没有数据!');
when too_many_rows then
dbms_output.put_line('数据过多!');
end ;
/
from yanyan2 where yanyan2.classname=yanyan_name;
if sql%found then
dbms_output.pur_line(yanyan_name||':');
end if;
for yanyan_cur in (select * from yanyan where classid=yanyanid)
loop
dbms_output.put_line('学号'||yanyan_cur.xh
||'姓名'||yanyan_cur.xm
||'工资'||yanyan_cur.sal);
end loop;
exception
when no_date_found then
dbms_output.put_line('没有数据!');
when too_many_rows then
dbms_output.put_line('数据过多!');
end ;
/
这个是不是返回了 多行值?
3、dbms_output.put_line('学号'||yanyan_cut.xh||'姓名'||yanyan_cut.xm||'工资'||yanyan_cut.sal);写成
dbms_output.put_line('学号'||yanyan_cur.xh||'姓名'||yanyan_cur.xm||'工资'||yanyan_cur.sal);