create or replace procedure ex2 as
x_rec dept.loc%type;
begin
 select loc into x_rec from dept;
 dbms_output.put_line(x_rec);
 exception
  when too_many_rows then
  dbms_output.put_line('too many rows');
   when others then
    dbms_output.put_line('cursor not opened');
end ex2;
/
