与表对象交叉加入行传播行(无需table()函数)
甲骨文空间具有称为 sdo_util.getvertices :
此功能返回mdsys.vertex_set_type的对象, 由mdsys.vertex_type的对象的表组成。
创建类型Vertex_set_type作为vertex_type的表;
getVertices()
函数通常与table()
函数一起使用。几何表与table(getVertices(shape))
互相加入,以便为每个几何繁殖顶点行:
with cte as (
select sdo_geometry('linestring (10 20, 30 40)') shape from dual union all
select sdo_geometry('linestring (50 60, 70 80, 90 100)') shape from dual union all
select sdo_geometry('linestring (110 120, 130 140, 150 160, 170 180)') shape from dual)
select
v.*
from
cte, table(sdo_util.getvertices(shape)) v
X Y Z W V5 V6 V7 V8 V9 V10 V11 ID
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
10 20 1
30 40 2
50 60 1
70 80 2
90 100 3
110 120 1
130 140 2
150 160 3
170 180 4
文档中的示例建议使用table() 。
但是从快速测试中,似乎不需要使用table()
函数。如果我从查询中删除table()
函数,则会产生相同的结果。
问题:
如何与表对象进行跨加入会传播行 - 而无需table()
函数?
文档建议我们应该使用table()
函数,所以我想知道这在Oracle的较旧版本中是否正确,但是也许在较新版本中发生了什么变化?
相关:
Oracle Spatial has a function called SDO_UTIL.GETVERTICES:
This function returns an object of MDSYS.VERTEX_SET_TYPE, which
consists of a table of objects of MDSYS.VERTEX_TYPE.CREATE TYPE vertex_set_type as TABLE OF vertex_type;
The GetVertices()
function is typically used in conjunction with the Table()
function. The geometry table is cross-joined with table(getvertices(shape))
to propagate vertex rows for each geometry:
with cte as (
select sdo_geometry('linestring (10 20, 30 40)') shape from dual union all
select sdo_geometry('linestring (50 60, 70 80, 90 100)') shape from dual union all
select sdo_geometry('linestring (110 120, 130 140, 150 160, 170 180)') shape from dual)
select
v.*
from
cte, table(sdo_util.getvertices(shape)) v
X Y Z W V5 V6 V7 V8 V9 V10 V11 ID
----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
10 20 1
30 40 2
50 60 1
70 80 2
90 100 3
110 120 1
130 140 2
150 160 3
170 180 4
And the examples in the docs suggest using Table()
as well.
But from a quick test, using the table()
function doesn't seem to be necessary. If I remove the Table()
function from the query, it produces the same result.
Question:
How is it possible that cross-joining with a table object propagates rows — without needing the Table()
function?
The docs suggest that we should use the Table()
function, so I wonder if that was correct in older versions of Oracle, but maybe something changed in newer versions?
Related:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在Oracle 12或Oracle 18中,
Table
Table Collection表达式的关键字已成为语法的可选部分,因此:将在所有Oracle版本(支持集合)上使用。
和:
将从Oracle 18(也许还有Oracle 12)起作用,并做完全相同的事情(但会在早期版本中提出语法错误)。
我正在尝试找到新功能的文档,但到目前为止还没有找到它。
In either Oracle 12 or Oracle 18, the
TABLE
keyword for table collection expressions was made an optional part of the syntax so:Will work on all oracle versions (that support collections).
And:
Will work from Oracle 18 (and maybe Oracle 12) and do exactly the same thing (but would raise syntax errors in earlier versions).
I'm trying to find the documentation for the new feature but so far haven't found it.