7 Replies Latest reply: Jul 2, 2013 10:20 PM by Brian Bontrager RSS

    Reg: CURSOR FOR LOOP

    GopalaKrishna

      Hi,

       

      I am trying to display the employee's information at particular location of a company using cursor for loop.

      It is not giving any output.and I could not locate the error also. can anyone help me in this regard.

       

      declare

      cursor emp_cursor ( v_loc dept.loc%type) is

      select * from emp where deptno=(select deptno from dept where loc=v_loc);

       

      p_loc dept.loc%type;

       

      Begin

       

      p_loc  := &n;

      DBMS_OUTPUT.PUT_LINE('employee Info at' || p_loc);

       

      For emp_record in emp_cursor(p_loc)

      LOOP

      DBMS_OUTPUT.PUT_LINE('employee name' || emp_record.ename);

      DBMS_OUTPUT.PUT_LINE('employee number' || emp_record.empno);

      END LOOP;

       

      END;