Q:

Write a program in PL/SQL to FETCH single record and single column from a table

0

Write a program in PL/SQL to FETCH single record and single column from a table.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

DECLARE
  v_emp_name VARCHAR2(50);
  CURSOR emp_cur_name IS
    SELECT first_name
    FROM   employees
    WHERE  employee_id = 105;

BEGIN
  OPEN emp_cur_name;
  FETCH emp_cur_name
  INTO  v_emp_name;
  
  dbms_output.put_line('The name of the employee is:’
  || v_emp_name);
  CLOSE emp_cur_name;
END;
/
Sample Output:
SQL> /
The name of the employee is:David

PL/SQL procedure successfully completed.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now