日期:2014-05-17  浏览次数:20954 次

必须声明 'DEPTNO' 组件 闹哪样?
declare
v_empno emp.empno%type :=&empno;
type tableType is table of emp%rowtype index by binary_integer;
v_emp tableType;
begin 
select * bulk collect into v_emp from emp where empno=v_empno;
if v_emp.count>0 then
dbms_output.put_line('查到此雇员');
if v_emp.deptno=30 then
dbms_output.put_line('此雇员属于SALES部门');
delete from emp where empno=v_empno;
 else
 dbms_output.put_line('此雇员不属于SALES部门,不能删除');
 end if;
else
dbms_output.put_line('找不到此雇员');
end if;
end;
这个PL/SQL块 运行时提示 必须声明 'DEPTNO' 组件
实在不知道哪里出问题了

------解决方案--------------------
if v_emp.deptno=30 then


不能直接引用,必须加下标索引,如v_emp(1).deptno=30