获取嵌套 table 的引用值

get value of reference of a nested table

我正在尝试编写一个查询以获取 IP 地址,该 IP 地址是 table 的嵌套 table 的引用,table 是另一个嵌套 table 的引用。

create type t_pc as object (
        Nserie number(20),
        adrIP VARCHAR(20),
        cpu VARCHAR(20)
    );

create type t_instatype as object(
    dateinst VARCHAR(20) ,
    refPC REF t_pc 
);

create type t_installations as table of t_instatype ;

create type t_logiciel as object (
    nomlogi VARCHAR(20) ,
    versionL VARCHAR(20) ,
    editeur VARCHAR(20),
    installationsR t_installations
);

create type t_refLogiciel as object (
    refLogiciel ref t_logiciel
);

create type t_reflogiciels as table of t_reflogiciel ;

create type t_adrType as object (
    rue VARCHAR(20) ,
    ville VARCHAR(20)
);

create type t_Depatement as object (
        codeDept number(20) ,
        nomDept varchar(20) ,
        budget varchar(20) ,
        refLogicielR t_reflogiciels ,
        AdrR t_adrType 
    );

以下是 table:

create table Departement of t_Depatement 
    nested table refLogicielR store as rlogi ; 

create table Logiciel of t_logiciel 
    nested table installationsR store as insta ; 

create table PC of t_pc ;

这里的图片显示了我的 tables 和数据

我的查询应该检索 nomDept,其中 ADRIP 等于 = '192.168.2.'4 ;

提前致谢

你可以学习一下Performing DML Operations on Collections (at: Unnesting Queries with Multilevel Collections) on Oracle Objects docs:

Unnesting queries can be also used with multilevel collections, both varrays and nested tables.

这是查询:

SELECT d.nomDept
FROM Departement d, 
     table( d.refLogicielR ) l, 
     table( l.refLogiciel.installationsR) i
WHERE i.refPC.adrIP = '192.168.2.4'

我想,有了这个答案,我已经解锁了下一个 Oracle Objects 怪异级别。