Consider the below PL/SQL code to display employee details of department 20. What will be the result after executing this code?

DECLARE
  CURSOR cur_emp_in_dept
  IS
    SELECT employee_id,salary,hire_date FROM employees WHERE department_id=20 ;
  v_emp_id employees.employee_id%TYPE;
  v_salary employees.salary%TYPE;
  v_hire_date employees.hire_date%TYPE;
BEGIN
   OPEN cur_emp_in_dept;
  LOOP
    FETCH cur_emp_in_dept INTO v_emp_id,v_salary,v_hire_date;
     EXIT
  WHEN cur_emp_in_dept%NOTFOUND;
    DBMS_OUTPUT.put_line ('Employee ID: ' || v_emp_id);
    DBMS_OUTPUT.put_line ('Salary: ' || v_salary);
    DBMS_OUTPUT.put_line ('Joining date: ' || v_hire_date);
  END LOOP;
  CLOSE cur_emp_in_dept;
   DBMS_OUTPUT.put_line ('RowCount: '||cur_emp_in_dept%rowcount);
END;

 

Program completes successfully and display employee details of department 20
Error: Select statement retreives more than one row
Error: Explicit cursor attributes cannot be accessed after cursor is closed
Error: Fetch cannot retreive values into more than one variable
Verified Answer
Correct Option - c

To get all PLSQL Assessment Exam questions Join Telegram Group https://bit.ly/infy_premium_group

Telegram

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in

Updated on Fri, 13 Jun 2025