write cursor program to fetch top five highest salaries employee

 write cursor program to fetch top five highest salaries employee


For Explanation Watch Video ::



Program::

declare cursor c1 is select ename,sal from emp order by sal desc;
v_ename varchar2(10);
v_sal number(10);
begin
open c1;
loop
fetch c1 into v_ename,v_sal;
exit when c1%rowcount>5;
dbms_output.put_line(v_ename||','||v_sal);
end loop;
end;
/


Comments

Popular posts from this blog

Print Prime Numbers Hackerrank Solution - PL/SQL

how to store html form data in mysql database using hibernate