Anyone knows how to do this in PL/SQL?


  • 0
    U

    I'm new to PL/SQL and it seems the syntax of Oracle SQL is a little different from MySQL. Any reply will be appreciated.


  • 0
    U

    I figured if out by myself...

    declare
        cursor c1 is
            select name from employees e
            where salary > ( select salary from employees
                             where id = e.managerid
                           )
            order by name;
    begin
        for person in c1
        loop
            dbms_output.put_line(person.name);
        end loop;
    end;
    /
    

  • 0
    U

    Actually, we don't really need the cursor and the loop, the SQL part is enough


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.