create or replace procedure temp is
line number;
cursor mycur is select count(*) from gl_unit;
begin 
open mycur;
loop
fetch mycur into line;
exit when mycur%notfound
dbms_output.put_line(line);
end loop;
close mycur;
commit;
end temp;
/set serveroutput on;
exec temp;

解决方案 »

  1.   

    create or replace procedure temp is
    line number;
    cursor mycur is select count(*) from gl_unit;
    begin 
    open mycur;
    loop
    fetch mycur into line;
    exit when mycur%notfound;---这里少个分号
    dbms_output.put_line(line);
    end loop;
    close mycur;
    commit;
    end temp;
    /一般只有一个结果就粗需要游标了,之间SQL语句就行了select count(*) into aa from gl_unit;