create or replace type Entertainment_ty as object(
create or replace type Spot_ty under Entertainment_ty (
create or replace type Trailer_ty under Entertainment_ty (
of_film REF Film_ty,
I created the object table for Film_ty and Entertainment_ty using +"create table entertainment of Entertainment_ty"+ and +"create table film of Film_ty"+ . I didn't create any collection or object table for Trailer_ty, because I read on the "Object Oriented Oracle" book that I don't have to do it if I want a mutual-exclusive inheritance relation. Now, I want to delete the trailer of a given film. How can I do such a thing if I can't access to the reference in the entertainment table, with something like "+entertainment.of_film+ "?
I also tried a simple query of selection: "+select value(e) from entertainment e;+" The result is "[owner.Trailer_ty]". I can't find a way to access to the data stored in the object table entertainment referred to the Trailer_ty type.
Can you help me to solve it, please??
Use the TREAT function to access the object as a TRAILER_TY instance and read its specific attributes.
For example, the following retrieves the REF pointer of film #1 in a subquery and uses it in a filter predicate to access the corresponding trailer :
where object_value is of (trailer_ty)
and treat(object_value as trailer_ty).of_film =
from film t
where t.film_id = 1