编译报错,不知道是不是%raw type用法不对。teacher是一个表,有teacher_id和teacher_name两个字段。
CREATE OR REPLACE PROCEDURE showteacher
as teachInfo teacher %raw type;
begin
select * into teachInfo from teacher where teacher_id = '1';
dbms_output.put_line(teachInfo.teacher_name);
end;
CREATE OR REPLACE PROCEDURE showteacher
as teachInfo teacher %raw type;
begin
select * into teachInfo from teacher where teacher_id = '1';
dbms_output.put_line(teachInfo.teacher_name);
end;
CREATE OR REPLACE PROCEDURE showteacher
as
v_cr SYS_refcursor;
teachInfo teacher%rowtype;
begin
open v_cr for select * from teacher where teacher_id = '1';
loop
fetch v_cr into teachInfo;
exit when v_cr%NOTFOUND;
dbms_output.put_line(teachInfo.teacher_name);
end loop;
close v_cr;
end;
/