title: Oracle PL/SQL using cursor with for loop for data retrieving
body: <p>Hi I am trying to use for loop for retrieving data in oracle pl/sql but I am getting an error can someone help me </p>
  
  <pre><code>SET SERVEROUTPUT ON
  DECLARE
  
    fname employees.first_name%TYPE;
    empid employees.employee_id%TYPE;
    CURSOR emp_cursor IS
    SELECT employee_id,first_name from employees ORDER BY employee_id;
  
  BEGIN
  
    open emp_cursor;  
    FOR empid IN emp_cursor loop
  
    DBMS_OUTPUT.PUT_LINE('employee id is ' ||empid || 'first name is '||fname);
  
  end LOOP;
  
  END;
  </code></pre>
  
  <p>I am getting an error on the DBMS output line something like the number or type of variables not right. I am trying to retrieve employee id and first name from employees table in oracle sample schema.</p>
  
  <p>Can someone please guide me</p>