Advertisement
RashedBQ

CURSOR

Oct 10th, 2021
282
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE
  2. CURSOR emp_show IS
  3.     SELECT employee_id,first_name,salary
  4.     FROM employees;
  5.    
  6.     emp_rec emp_show%ROWTYPE;
  7.  
  8.  
  9. BEGIN
  10.  
  11. OPEN emp_show;
  12.  
  13. FETCH emp_show INTO emp_rec;
  14.  
  15. WHILE emp_show%found
  16. LOOP
  17.  
  18.  
  19. DBMS_OUTPUT.put_line('employee id: '||emp_rec.employee_id);
  20. DBMS_OUTPUT.put_line('First Name : '||emp_rec.first_name);
  21. DBMS_OUTPUT.put_line('Salary : '||emp_rec.salary);
  22. FETCH emp_show INTO emp_rec;
  23. END LOOP;
  24.  
  25. CLOSE emp_show;
  26.  
  27. END;
  28.  
Advertisement
RAW Paste Data Copied
Advertisement