This discussion is archived
4 Replies Latest reply: Feb 5, 2013 11:26 AM by Barbara Boehmer RSS

PL/SQL Object Dependant Inheritance

oBean Newbie
Currently Being Moderated
I'm trying out some OOP coding in PL/SQL to see if it might be worth using in a project. So far it's not looking good...

Say I have 2 objects, Organization and Department. Org looks like:

create type Organization as object (
org_type varchar2,
org_location varchar2,
depts Departments -- the departments collection (there are many departments)
) not final;

and the Department object I want to inherit the orgs attributes, and looks like:

create type Department as object under Organization (
dept_number varchar2,
dept_name varchar2
);

then the Departments collection:

create type Departments as table of Department;

Now this all fails because I can't compile Department until Organization is compiled, and I cant compile that until Departments is compiled...which cannot be created until Department exists...

I tried using a forward type definition, like so:

create type Departments;

which creates, but the Organization and Department still fail to compile.

I think I'm missing something conceptually or syntactically...not sure which...

How would such a scenario be coded?