Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Help: Oracle8, object type, table type and functions
Hello,
I am working with Oracle 8, and I would like to use the object oriented features of oracle, but I am facing some problems. So, I will try to explain here my problems, and I hope that someone would be able to help me.
I create an object type, then a type which is a table of this previous
type, and in last step, another object type which contains an attribut
from this second type.
Here they are:
create type budget as object
(amount numeric
);
create type budgets_t as table of budget;
CREATE TYPE project_t AS OBJECT
(pno CHAR(5),
pname CHAR(20),
budgets budgets_t,
member function get_max return number,
pragma restrict_references(get_max,WNDS,WNPS)
);
As you can see I also defined a function in the project_t type. Therefore I tryed to implement this function giving the body type as :
create or replace type body project_t as
member function get_max return number is
to_return numeric := 0;
begin
select max(amount) into to_return from SELF.budgets;
return to_return;
end;
end;
In fact this function only return the maximum value for amount stored in the
nested table budgets.
But here this function body is not valid, and I got the following error
message:
PLS-00356: "SELF.BUDGETS' must name a table to which the user has access
But I am using the same user to create the different types, and to give the body of this function.
What is the problem ? And what is the solution ?
Thanks in advance for any help.
![]() |
![]() |