我在编码时遇到这种类型的错误:
ORA-01722:无效编号ORA-06512:在第17行 01722. 00000-“无效号码”
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;
我希望记录的输出既与两个表的管理员ID匹配,又与用户给定的具有经理表的部门的名称匹配
答案 0 :(得分:0)
您的游标for循环看起来不正确-您没有在游标中选择变量-您使用了在for循环中隐式声明的记录,如下所示:
let efd = Box::new(EventedFd(&fd.as_raw_fd()));
Blah {efd}
我已经对您的代码进行了格式化,以使其更易于阅读(尽管我使用的特定格式不是所有格式的结尾,而是全部!)。