Oracle 8i - PLS-00905. Problem with type declaration
Date: 24 Apr 2003 04:28:38 -0700
Message-ID: <ffd131c3.0304240328.49fe9168_at_posting.google.com>
[Quoted] My problem is outlined below:
I have 3 types
1.
type t_client is object (
clt_id integer, clt_name varchar2(150), clt_country char(3));
2.
type t_clients is table of t_client;
3.
type t_client_stack as object
(clients t_clients,
pragma restrict_references (default, trust, wnds),
member function equals (in_id pls_integer) return varchar2,
member procedure load_clients;
type body t_client_stack as
member function get_name (in_id pls_integer) return varchar2 is begin
for i in 1..clients.count loop if clients(i).clt_id = in_id then return clients(i).full_name; end if; end loop; return 'unknown';
end get_name;
member procedure load_clients is
lcur ref cursor;
lsql varchar2(500) := 'select kt_id, full_name, country from
kt_client';
ldesc t_client;
begin
self.clients := t_clients();
OPEN lcur FOR lsql;
loop
fetch lcur into ldesc; if lcur%notfound then close lcur; exit; end if; self.clients.extend; self.clients(clients.last) := ldesc;
end loop;
end load_clients;
Now all I want to do is; within a package instantiate the type when by running a stored proc:
CREATE OR REPLACE package type_test
as
procedure loadviewset;
end type_test;
CREATE OR REPLACE package body type_test as
clts t_client_stack;
procedure loadviewset
is
v_name varchar2(150);
begin
clts := t_client_stack(t_clients()); clts.load_clients; v_name := clts.get_name(4); dbms_output.put_line('NAME: ' || v_name);end;
end type_test;
The compilation of the package body fails at - clts t_client_stack;
I cannot work out why. Does anyone have experience of dealing with types and had a similar problem. The error I get incidentally is:
PLS-00905: object T_CLIENT_STACK is invalid - WHY???? It compiles fine..
Thanks in advance Ken Received on Thu Apr 24 2003 - 13:28:38 CEST