create or replace procedure proc_err as
cursor x_cur is select * from dept;
x_rec x_cur%rowtype;
begin
loop
 open x_cur;
 fetch x_cur into x_rec;
  exit when x_cur%notfound;
   end loop;
 exception
  when invalid_cursor then
   dbms_output.put_line('not a valid cursor');
   when others then
    dbms_output.put_line('cursor not opened');
end proc_err;
/
