为什么当我试图在 plsql 中将空值与某个数字连接时,多重集并集不起作用?
Why multiset union is not working when I'm trying to concatenate a null with some number in plsql?
所以我有两个嵌套的 table,我想用它们中的元素创建一个新的,但是第一个嵌套的 table 有一个空值,第二个是一个数字我希望结果是第二个中的数字,但他打印了空值。可以使用 multiset union 在 null 和数字之间建立联合 ?
回答你的问题,是的,可以"make a union between a null and an number with multiset union"。但是你最终得到的是嵌套 table:
中的两个条目
SQL> update test
2 set marks = numberlist(null) multiset union all numberlist(42)
3 where id_std = 1
4 /
SQL> select id_std
2 , t2.column_value as mark
3 from test t1
4 , table(t1.marks) t2
5 /
ID_STD MARK
------ ----
1
1 42
SQL>
我怀疑这种影响实际上就是您所抱怨的。但是,空标记仍然是有效条目。如果你想覆盖它,你需要提供不同的逻辑。
所以我有两个嵌套的 table,我想用它们中的元素创建一个新的,但是第一个嵌套的 table 有一个空值,第二个是一个数字我希望结果是第二个中的数字,但他打印了空值。可以使用 multiset union 在 null 和数字之间建立联合 ?
回答你的问题,是的,可以"make a union between a null and an number with multiset union"。但是你最终得到的是嵌套 table:
中的两个条目SQL> update test
2 set marks = numberlist(null) multiset union all numberlist(42)
3 where id_std = 1
4 /
SQL> select id_std
2 , t2.column_value as mark
3 from test t1
4 , table(t1.marks) t2
5 /
ID_STD MARK
------ ----
1
1 42
SQL>
我怀疑这种影响实际上就是您所抱怨的。但是,空标记仍然是有效条目。如果你想覆盖它,你需要提供不同的逻辑。