Home » SQL & PL/SQL » SQL & PL/SQL » Error in displaying data from PL/SQL type (Oracle 9)
Error in displaying data from PL/SQL type [message #330942] Tue, 01 July 2008 20:53 Go to next message
anysql
Messages: 2
Registered: July 2008
Junior Member
I have defined a type in oracle.
Quote:

desc emptype;
Name Null? Type
----------------------------------------- -------- -------
emp_no NUMBER
emp_name VARCHAR2(40)
dept_no NUMBER


Here is the code
set serveroutput on
DECLARE
emptab emptype:=emptype();
begin
-- calling a function which returns collection type
 custom_pkg.get_emp_date(emptab);
IF (emptab.COUNT > 0) THEN

  FOR i IN emptab.FIRST..emptab.LAST LOOP
				
  DBMS_OUTPUT.PUT_LINE(emptab.emp_no(i));
  DBMS_OUTPUT.PUT_LINE(emptab.emp_namei));
  DBMS_OUTPUT.PUT_LINE(emptab.dept_no(i));
							
  END LOOP;
END IF;

end;


But I am getting the following error.
Quote:

ORA-06550: line 11
PLS-00302: component 'emp_no' must be declared
ORA-06550: line 12
PLS-00302: component 'emp_name' must be declared
ORA-06550: line 13
PLS-00302: component 'dept_no' must be declared


What may be wrong here?
Thanks in advance.
Re: Error in displaying data from PL/SQL type [message #330951 is a reply to message #330942] Tue, 01 July 2008 22:50 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9104
Registered: November 2002
Location: California, USA
Senior Member
emptab(i).emp_no not emptab.emp_no(i)
Re: Error in displaying data from PL/SQL type [message #330960 is a reply to message #330951] Tue, 01 July 2008 23:15 Go to previous message
anysql
Messages: 2
Registered: July 2008
Junior Member
Thnx.
It works now.
Previous Topic: how to get unupdated records?
Next Topic: Sql query help
Goto Forum:
  


Current Time: Mon Feb 10 11:47:36 CST 2025