I am getting this type of error while coding:
ORA-01722: invalid number ORA-06512: at line 17 01722. 00000 - "invalid number"
declare
dname varchar(15);
mname varchar(20);
sal number(20);
mid number(20);
row_worker worker%rowtype;
cursor work_cur(manid number) is select w.* from worker w ,manager m where w.manager_id = manid and w.manager_id=m.manager_id;
begin
dname:='&dname';
for x in(select m.department,m.name,m.salary,m.manager_id into dname,mname,sal,mid from manager m, worker w where m.department=dname and m.manager_id=w.manager_id)
loop
DBMS_OUTPUT.PUT_LINE('Department Name:'||dname||' Manager Name:'||mname||' Salary:'||sal);
DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE('Worker_id Name Specialized_in Salary Join_date Dept_name');
DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------------------------');
open work_cur(mid);
fetch work_cur into row_worker;
--exit when work_cur%notfound;
DBMS_OUTPUT.PUT_LINE(''||row_worker.worker_id||' '||row_worker.name||' '||row_worker.specialized_in||' '||row_worker.salary||' '||row_worker.join_date);
end loop;
DBMS_OUTPUT.PUT_LINE('------------------------------------------------------------------------------');
--DBMS_OUTPUT.PUT_LINE(1/n)
close work_cur;
end;
I expect the output of records that match the manager id of both the tables and also match the name of department with manager table given by user