Question: Based on the code below... What are the other ways you can run though all the data to display the entire result set? Provide the

Based on the code below...

  1. What are the other ways you can run though all the data to display the entire result set?
  2. Provide the syntax for the alternative approach to retrieve the same result.

DECLARE

CURSOR CUR_EMPLOYEE_DETAILS

AS

SELECT E.EMPLOYEE_ID AS EMPLOYEE_ID,

E.FIRST_NAME || || E.LAST_NAME AS EMPLOYEE_NAME,

E.JOB_ID AS JOB_ID,

J.JOB_TITLE AS JOB_TITLE,

J.MIN_SALARY AS MINIMUM_SALARY,

J.MAX_SALARY AS MAXIMUM_SALARY

FROM EMPLOYEES E, JOBS J

WHERE E.JOB_ID = J.JOB_ID;

RV_EMPLOYEE_DETAILS CUR_EMPLOYEE_DETAILS%ROWTYPE;

BEGIN

OPEN CUR_EMPLOYEE_DETAILS;

LOOP

FETCH CUR_EMPLOYEE_DETAILS INTO RV_EMPLOYEE_DETAILS ;

DBMS_OUTPUT.PUT_LINE(Employee ID: ||

rv_employee_details.employee_id);

Complete the remaining display of employees data based on the join statement.

EXIT WHEN CUR_EMPLOYEE_DETAILS%NOTFOUND;

END LOOP;

CLOSE CUR_EMPLOYEE_DETAILS;

EXCEPTION

WHEN NO_DATA_FOUND THEN

DBMS_OUTPUT.PUT_LINE(No data found);

END;

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!