Home » SQL & PL/SQL » SQL & PL/SQL » Inheritance and Collections
Inheritance and Collections [message #382062] Tue, 20 January 2009 16:49 Go to next message
peezy
Messages: 1
Registered: January 2009
Junior Member
Hello:

I am having an issue on collection of types that are inherited.

Here is a snippet:

definition code:

CREATE OR REPLACE TYPE PROPERTY AS OBJECT

(
PROPERTY_ID NUMBER(14),





)



CREATE OR REPLACE TYPE FIREARM UNDER PROPERTY

(

FIREARM_MODEL_NAME VARCHAR2(30),

..

..

)



CREATE OR REPLACE TYPE PROPERTIES AS TABLE OF PROPERTY;


Procedure Code

PROPERTIES:=PROPERTIES();

PROPERTIES(1):=PROPERTY();

PROPERTIES(1).PROPERTY_ID:=....

PROPERTIES(2):=FIREARM();

PROPERTIES(2).FIREARM_MODEL_NAME:=....

PLS-00302: component 'FIREARM_MODEL_NAME' must be declared



What I want is that the properties collection to be able to handle a firearm type and a property type. However, when I try to access the firearm type, it gives the above error. Is there anyway to be able to access this field?

Thanks in advance.
Re: Inheritance and Collections [message #382063 is a reply to message #382062] Tue, 20 January 2009 16:51 Go to previous messageGo to next message
BlackSwan
Messages: 25039
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.
Re: Inheritance and Collections [message #382237 is a reply to message #382062] Wed, 21 January 2009 08:06 Go to previous message
Alessandro Rossi
Messages: 166
Registered: September 2008
Location: Rome
Senior Member
If FIREARM is a subtype of PROPERTY you can't find its attributes on an object instanced as PROPERTY. You just did the opposite of the right way.



Bye Alessandro
Previous Topic: Need to get null values!
Next Topic: Select from 3 tables
Goto Forum:
  


Current Time: Mon Dec 05 21:30:50 CST 2016

Total time taken to generate the page: 0.07761 seconds