AddThis Social Bookmark Button

Using Cursor Select the Common deptno In Emp and Dept Table

 

DECLARE
   CURSOR c_emp IS
      SELECT *
        FROM emp;
cursor c_dept is select * from dept;
BEGIN
   FOR i IN c_emp
   LOOP
for j in c_dept
   loop
   if(i.deptno=j.deptno) then
      dbms_output.put_line(i.deptno);
end if;
end loop;
   END LOOP;
END;