You are on page 1of 1

declare

y number(4):=&year;
cursor year is select * from emp where to_char(hiredate,'yyyy')=y;
b year%rowtype;
begin
open year;
loop
fetch year into b;
exit when year%notfound;
dbms_output.put_line('*********************************');
dbms_output.put_line('emp no is :' || b.empno);
dbms_output.put_line('emp name is :' || b.ename);
dbms_output.put_line('emp sal is :' || b.sal);
dbms_output.put_line('hiredate is :' || b.hiredate);
dbms_output.put_line('emp job is :' || b.job);
dbms_output.put_line('*********************************');
end loop;
close year;
end;
/

You might also like