Answer to Question #252277 in Databases | SQL | Oracle | MS Access for Tarurendra Kushwah

Question #252277

Write a program in PL/SQL to FETCH multiple records and more than one columns from the same table.


1
Expert's answer
2021-10-16T11:02:19-0400
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; 
/

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS