Enter the code below in PL/SQL block into the Query Builder. Complete the remain
ID: 3909581 • Letter: E
Question
Enter the code below in PL/SQL block into the Query Builder.
Complete the remaining part as directed in the comment inside the BEGIN section of the anonymous block.
Compile and run the program by clicking on the green triangle. If you receive errors, correct them until the program runs correctly.
Part 2 Questions
What are the other ways you can run through all the data to display the entire result set?
Provide the syntax for the alternative approach to retrieve the same result.
DECLARE CURSOR CUR EMPLOYEE DETAILS AS SELECT E. EMPLOYEE ID E.FIRST NAME 11 ?.JOB ID J. JOB TITLE J.MIN SALARY J.MAX SALARY AS EMPLOYEE ID, AS EMPLOYEE NAME AS JOB ID, AS JOB TITLE, AS MINIMUM SALARY AS MAXIMUM SALARY 11 E·LAST NAME FROM EMPLOYEES E, JOBS J WHERE E.JOB1D=J.JOB1D; RV EMPLOYEE DETAILS CUR EMPLOYEE DETAILS %ROWTYPE; BEGIN OPEN CUR EMPLOYEE DETAILS FETCH CUR EMPLOYEE DETAILS LOOP DEMS OUTPUT. PUT LINE ('Employee ID :?11 rv employee details.employee id) Complete the remaining display of employee' s data based on the join statement EXIT WHEN RV EMPLOYEE DETAILS%NOTFOUND; END LOOP EXCEPTION WHEN NO DATA FOUND THEN DBMS OUTPUT. PUT LINE 'No data found ENDExplanation / Answer
DECLARE
CURSOR CUR_EMPLOYEE_DETAILS
AS
SELECT E.EMPLOYEE_ID AS EMPLOYEE_ID,
E.FIRSTNAME || ' ' || E.LASTNAME 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 EMPLOYEE E, JOB J
WHERE E.JOB_ID = J.JOB_ID;
RV_EMPLOYEE_DETAILS CUR_EMPLOYEE_DETAILS%ROWTYPE;
BEGIN
OPEN CUR_EMPLOYEE_DETAILS;
FETCH CUR_EMPLOYEE_DETAILS;
LOOP
DBMS_OUTPUT.PUT_LINE('Employee ID: ' || RV_EMPLOYEE_DETAILS.employee_id);
DBMS_OUTPUT.PUT_LINE(
`EmployeeName:`|| rv.employee.details.employee_name || CHR(13) || CHR(10)||
`Job ID:`|| rv.employee.details.job_id || CHR(13) || CHR(10)||
`Job Title: `|| rv.employee.details.job_title, || CHR(13) || CHR(10)||
`MinimumSalary: `|| rv.employee.details.minimum_salary || CHR(13) || CHR
(10)||
`MaximumSalary:`|| rv.employee.details.maximum_salary
);
EXIT WHEN RV_EMPLOYEE_DETAILS%NOTFOUND;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No data found');
END;
Let me know if you have any clarifications. Thank you....
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.