1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

first higest salary employees using cursor for loop

Discussion in 'SQL PL/SQL' started by mist, Jan 9, 2014.

  1. mist

    mist Active Member

    Messages:
    59
    Likes Received:
    2
    Trophy Points:
    160
    Hi all,

    please tel me i want to get the first higest salary employees from emp table using cursor for loop is it possible tel me?


    Thank You
     
  2. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    declare
    cursor c1 is
    SELECT *
    FROM emp
    WHERE sal = (SELECT Max(sal) FROM emp) ;
    begin
    for i in c1 loop
    dbms_output.put_line(i.empno||' '||i.ename||' '||i.sal);
    end loop;
    end;

    Hope this will help you...
     
    mist likes this.
  3. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,351
    Likes Received:
    348
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    And again answers are provided with no work from the person asking for 'help'; such actions do no one any good and develop a dependency on others to get work done. I do understand the desire to help but simply giving out answers rather than assisting the poster with issues he or she may be having is a disservice.]