我正在尝试通过父级访问对象的子级变量
declare
i a22;
i1 VARCHAR(10);
begin
i := a22('a22', t_b1(
b22('b22', t_a1(a22('a22_2', t_b1(b22('b22_2', t_a1())))))
)
);
dbms_output.put_line('i.name_a1='||i.name_a1);
dbms_output.put_line('i.t_b1(1).name_b1='||i.o_b(1).name_b1);
dbms_output.put_line('i.o_b(1).o_a(1).name_a1='||i.o_b(1).o_a(1).name_a1);
end;
/
编译时发生错误,指示需要声明变量。父级不知道子级对象的变量是合乎逻辑的。但是当初始化一切 成功。如何访问子变量?
对象本身:
Create type a1 is object (
name_a1 varchar2(10)
) NOT FINAL NOT INSTANTIABLE;
Create type b1 is object (
name_b1 varchar2(10)
) NOT FINAL NOT INSTANTIABLE;
create type t_a1 is table of a1;
create type t_b1 is table of b1;
Create type b22 UNDER b1 (
o_a t_a1
) INSTANTIABLE;
Create type a22 UNDER a1 (
o_b t_b1
) INSTANTIABLE;
答案 0 :(得分:2)
您可以使用TREAT
函数来访问对象子类型的属性。
由于.btn-group button {
background-color: #4CAF50; /* Green background */
border: 1px solid green; /* Green border */
color: white; /* White text */
padding: 10px 24px; /* Some padding */
cursor: pointer; /* Pointer/hand icon */
float: left; /* Float the buttons side by side */
}
.btn-group button:not(:last-child) {
border-right: none; /* Prevent double borders */
}
/* Clear floats (clearfix hack) */
.btn-group:after {
content: "";
clear: both;
display: table;
}
/* Add a background color on hover */
.btn-group button:hover {
background-color: #3e8e41;
}
的类型为o_b
,因此您必须将对象table of b1
视为o_b(1)
,因为只有b22
对象包含类型{{ 1}}
b22
结果:
table of a1
db <>提琴here