Question: Write short programs as requested, the outputs of the program are required to be attached in your submission. Q 1 , ( 1 5 points

Write short programs as requested, the outputs of the program are required to be attached in your submission.
Q1,(15 points) A standalone procedure, based on Employees Table.
In this question, you will create a standalone Procedure called Calc_bonus. This procedure will Get an employee's ID, then calculate the bonus according to the policy below. It should claim one IN parameter (you give it a name), its data type is same as employee_id (number (6)), and one OUT mode parameter (you give it a name), that is the bonus calculated based on the policy.
For employees that their salaries are $10,000 or more, bonus is $2,000.
For employees that their salaries are $7,000 or more but less than $10,000, bonus is $1,600.
For employees that their salaries are $5,000 or more but less than $7,000, bonus is $1,300.
All other employees will get $1,000.
After having successfully compiled the procedure, write an anonymous PL/SQL program. It will call this procedure Calc_bonus for each employee in department 20 and 30. The program will print out each employee's ID, salary, and the bonus.
Also, your program will print out the total bonus for this department 20 and 30.
Q2.(15 points) Write a PL/SQL (block) program, based on Locations and Departments table.
In this question you will define a user-defined record type, then define a nested table data type using this record type as its element. The detailed requirements are as below.
Define a user-defined record type called Dept_Loc has two fields in it:
D_No: correspondent to department_id in the Departments table),
D_Loc: this will be the concatenation of street_address, a comma and a space (||',||), then the city name from the Locations table.
After having defined this record type, your program will declare a nested table data type called Dept_Loc_List that use this record type as its element. You should declare a variable of this nested table data type, you give it a name.
Your program will retrieve the data from Departments and Locations tables for all the departments that have a department manager assigned. Populate this nested table variable with the retrieved data, print out the contents of it: the department ID's and the location strings for each department. Please make the output order by the department ID.
In this question, you are required to use cursor for loop.
 Write short programs as requested, the outputs of the program are

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!