Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a new table from the existing HR_EMPLOYEES table, using CTAS: make table a2_employees as select * from hr_employees; Make a PL/SQL procedure to display

Make a new table from the existing HR_EMPLOYEES table, using CTAS: 

make table a2_employees as select * from hr_employees; 

Make a PL/SQL procedure to display some information from the newly created table A2_EMPLOYEES and also to update salary, for a specific department ID. The procedure should read row by row using explicit cursor and calculate average salary for the job id that the employee performs. If  the salary is lower that the average tor that job ID, then update the employee's salary to the average and display old salary, new salary, and the difference. If the salary is higher than the average, display the salary and the difference from the average salary for that job id. Calculate the total amount of money that the department will need for the salary increase for all its employees. 

Provide an anonymous block that will call this procedure for several values of department ID. 

You can use the following SQL statements for testing: 

select distinct department_id, count(1) from a2_employees group by department_id;  select * from a2_employees where department_id = 50 order by job_id, employee_id; An example of the output is displayed bellow: 

Step by Step Solution

3.52 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

To achieve this in PLSQL you can create a procedure to perform the required tasks and then use an anonymous block to call the procedure for different ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Using Excel & Access for Accounting 2010

Authors: Glenn Owen

3rd edition

1111532672, 978-1111532673

More Books

Students also viewed these Databases questions