PLS-00382: expression is of wrong type
730915Jan 5 2011 — edited Jan 5 2011Hi Forum,
Could some one explain me the behavior of the following second block.. Why the error?
select * from v$version
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 64-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
set serveroutput on
declare
type type_emp is table of emp%rowtype;
v_emp type_emp:=type_emp();
begin
for i in (select * from emp)
loop
v_emp.extend;
v_emp(v_emp.last):=i;
end loop;
dbms_output.put_line('Out put :'||v_emp.count);
end;
Out put : 14
set serveroutput on
declare
type type_emp is table of emp.ename%type;
v_emp type_emp:=type_emp();
begin
for i in (select ename from emp)
loop
v_emp.extend;
v_emp(v_emp.last):=i;
end loop;
dbms_output.put_line('Out put :'||v_emp.count);
end;
ERROR at line 8:
ORA-06550: line 8, column
PLS-00382: expression is of wrong type
ORA-06550: line 8, column
PL/SQL: Statement ignored
Thanks,
Mahesh