Question: Queries required for this Question: --lab_07_01.sql DROP TABLE top_salaries; CREATE TABLE top_salaries (salary NUMBER(8,2) ); Before this question please execute script in your Assigment1 folder
Queries required for this Question:
--lab_07_01.sql
DROP TABLE top_salaries;
CREATE TABLE top_salaries (salary NUMBER(8,2) );

Before this question please execute script in your Assigment1 folder name lab_07_01.sql to create required table Create a PL/SQL block that determines the top n salaries of the employees. a. Execute the lab_07_01.sql script to create a new table, top_salaries, for storing the salaries of the employees. b. In the declarative section, declare a variable v_num of type NUMBER that holds a number n representing the number of top n earners from the employees table. For example, to view the top five salaries, enter 5. Declare another variable sal of type employees.salary. Declare a cursor, c emp cursor, that retrieves the salaries of employees in descending order In the executable section, open the loop and fetch top n salaries and insert them into top_salaries table. You can use a simple loop to operate on the data. Also, try and use %ROWCOUNT and % FOUND attributes for the exit condition Note: Make sure you add an exit condition to avoid having an infinite loop c. d. After inserting into the top_salaries table, display the rows with a SELECT statement. The output shown represents the five highest salaries in the employees table SALARY 24000 17000 14000 Aca
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
