日期:2014-05-17 浏览次数:20830 次
set serveroutput on
declare
cursor cur_s_emp is
select t.last_name, t.first_name, t.salary
from s_emp t
where t.dept_id = &v_dept_id;
cur_s_emp1 cur_s_emp%rowtype;
begin
open cur_s_emp;
loop
fetch cur_s_emp into cur_s_emp1;
exit when cur_s_emp%notfound;
dbms_output.put_line(cur_s_emp1.last_name||cur_s_emp1.first_name ||cur_s_emp1.salary);
end loop;
close cur_s_emp;
end;
/
exception
when NO_DATA_FOUND then
dbms_output.put_line('NO_DATA_FOUND-ORA-01403');
when OTHERS then
dbms_output.put_line(cur_s_emp1.last_name||cur_s_emp1.first_name ||cur_s_emp1.salary);