PL/SQL: Join between two tables error -
i have got task in have display information 2 different tables using cursor. tried doing example did before, doesn't seem work! below mentioned 2 tables have take records , display them.
'emp' table
'dept' table
i want display employee number, names, salary, department name , department location working in.
below did:
set serveroutput on; declare cursor staff_cursor select e.empno,e.ename,e.sal, d.dname, d.dloc emp e, dept d e.deptno = d.deptno; v_eno emp.empno%type; v_lname emp.ename%type; v_esal emp.sal%type; v_ddname dept.dname%type; v_dloc dept.dloc%type; begin dbms_output.put_line ('******************'); open staff_cursor; fetch staff_cursor v_eno, v_lname, v_esal, v_ddname, v_dloc; while staff_cursor%found loop dbms_output.put_line (v_eno); dbms_output.put_line (v_lname); dbms_output.put_line (v_esal); dbms_output.put_line ('******************'); dbms_output.put_line (v_ddname); dbms_output.put_line (v_dloc); fetch staff_cursor v_eno, v_lname, v_esal, v_ddname, v_dloc; end loop; close staff_cursor; end;
it gives me error d.dloc invalid identifier. don't understand problem, i’m hoping me in it.
your cursor select d.dloc
of table dept d
, named loc
in screenshot.
cursor staff_cursor select e.empno, e.ename, e.sal, d.dname, d.loc -- ...
Comments
Post a Comment