Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Trying to print the details of the min and max salary and the employee details, just one min and one

2898696Mar 6 2015 — edited Mar 6 2015

set serveroutput on;

declare

vmaxsalary number(6);

vlastname varchar2(50);

vfirstname varchar2(50);

var_empID number (6);

mvminsalary number(6);

mvlastname varchar2(50);

mvfirstname varchar2(50);

mvar_empID number (6);

begin

  select max(salary), employee_ID, last_name, first_name into vmaxsalary, var_empID, vlastname, vfirstname from employees order by max;

  dbms_output.put_line('Employee ID ' || var_empID || ' Name ' || vfirstname || '  ' || vlastname || ' has the highest salary ' || vmaxsalary);

  select min(salary), employee_ID, last_name, first_name into mvminsalary, mvar_empID, mvlastname, mvfirstname from employees order by min;

  dbms_output.put_line('Employee ID ' || mvar_empID || ' Name ' || mvfirstname || '  ' || mvlastname || ' has the lowest salary ' || mvminsalary);

end;

/

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 3 2015
Added on Mar 6 2015
13 comments
2,410 views