Re: Oracle 8i - PLS-00905. Problem with type declaration

From: Thomas Olszewicki <ThomasO_at_NoSpam.cpas.com>
Date: Fri, 25 Apr 2003 18:54:18 GMT
Message-ID: <uvfqa.182170$jVh.1606_at_news01.bloor.is.net.cable.rogers.com>


Ken,
You have errors in type t_client_stack:

  1. Type definition doesn't match type body: equals vs. get_name.
  2. in procedure load_clients : lcur ref cursor -- this is wrong declaration.

You must compile your type definition without errors before you can use it.

HTH
Thomas

"kenster10" <stewartkenster_at_aol.com> wrote in message news:ffd131c3.0304240328.49fe9168_at_posting.google.com...
> 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 Fri Apr 25 2003 - 20:54:18 CEST

Original text of this message