我预计在以下代码变量中x
并y
引用相同的嵌套表对象,但表达式y = x
似乎在y
. 所以输出令人惊讶的是'No:a c'(但我期望'Yes:ab c')。我应该在 PL/SQL 中做什么才能y
将相同的嵌套表对象引用为x
.
declare
type str_t is table of varchar(100);
x str_t := str_t ();
y str_t ;
begin
x.extend; x(x.last) := 'a';
y := x;
y.extend; y(y.last) := 'b';
x.extend; x(x.last) := 'c';
dbms_output.put_line(case when x=y then 'Yes: ' else 'No: ' end);
for i in x.first .. x.last
loop
dbms_output.put_line(x(i));
end loop;
Сan它(通过引用传递嵌套表 - 不是通过值)用PL / SQL编写还是根本不可能?语言中是否存在任何替代方案来避免该问题?