Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PLS-00382: expression is of wrong type

730915Jan 5 2011 — edited Jan 5 2011
Hi 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
This post has been answered by MaximDemenko on Jan 5 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 2 2011
Added on Jan 5 2011
4 comments
9,633 views