Write a program in PL/SQL to FETCH multiple records and more than one columns from the same table.
DECLARE
v_emp_rec employees%ROWTYPE;
CURSOR cur_emp_name IS
SELECT *
FROM employees;
BEGIN
OPEN cur_emp_name;
LOOP
FETCH cur_emp_name INTO v_emp_rec;
exit WHEN cur_emp_name%NOTFOUND;
dbms_output.Put_line('Name: '
|| v_emp_rec.first_name
|| ' :: Salary: '
|| v_emp_rec.salary);
END LOOP;
CLOSE cur_emp_name;
END;
/
Comments
Leave a comment