创建SDO_GEOMETRY对象的ODCI列表
我最近了解了ODCI列表(在 @mt0 的答案中。
例如,odcivarchar2list
:
select
sys.odcivarchar2list('a', 'b', 'c') as my_list
from
dual
MY_LIST
-------------------------------
ODCIVARCHAR2LIST('a', 'b', 'c')
出于好奇,是否有一种方法可以创建mdsys.sdo_geometry
对象的ODCI列表?
我尝试使用odciobjectList
:
select
sys.ODCIObjectList(
sdo_geometry('point(10 20)'),
sdo_geometry('point(30 40)'),
sdo_geometry('point(50 60)')
) as my_list
from
dual
但是我有一个错误,表明odciobjectList
并不是sdo_geometry
对象:
ORA-00932: inconsistent datatypes: expected SYS.ODCIOBJECT got MDSYS.SDO_GEOMETRY
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
Error at Line: 3 Column: 9
I recently learned about ODCI lists (in an answer from @MT0).
For example, an OdciVarchar2List
:
select
sys.odcivarchar2list('a', 'b', 'c') as my_list
from
dual
MY_LIST
-------------------------------
ODCIVARCHAR2LIST('a', 'b', 'c')
Out of curiosity, is there a way to create a ODCI list of MDSYS.SDO_GEOMETRY
objects?
I tried using ODCIObjectList
:
select
sys.ODCIObjectList(
sdo_geometry('point(10 20)'),
sdo_geometry('point(30 40)'),
sdo_geometry('point(50 60)')
) as my_list
from
dual
But I got an error, suggesting that ODCIObjectList
isn't meant for sdo_geometry
objects:
ORA-00932: inconsistent datatypes: expected SYS.ODCIOBJECT got MDSYS.SDO_GEOMETRY
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:
*Action:
Error at Line: 3 Column: 9
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,
odci
类型是属于sys
架构的内置类型,并且没有odci
列表可以容纳SDO几何对象。您要么创建自己的收集类型; 请参阅Justin Cave的答案。
或者,您需要寻找其他内置收集类型。
要查找现有的集合类型,您可以使用:
找到所有内置集合的列表。
SDO对象是在
mdsys
架构中定义的,您可以过滤到使用:其中包含92个集合类型的那些;其中之一是
sdo_geometry_array
类型,它恰好可以按照您想要的方式完成。因此,如果您不想创建自己的类型,则可以使用:
或者更简单:
No, the
ODCI
types are built-in types belonging to theSYS
schema and there is noODCI
list that can hold SDO geometry objects.You either create your own collection type; see Justin Cave's answer.
Or you need to look for a different (non-ODCI) built-in collection type.
To find the existing collection types, you can use:
To find a list of all the built-in collections.
The SDO objects are defined in the
MDSYS
schema and you can filter to just those using:Which contains 92 collection types; one of which is the
SDO_GEOMETRY_ARRAY
type which happens to do exactly what you want.Therefore, if you do not want to create your own type, you can use:
or, more simply:
声明自己的收集类型非常简单,绝对是要走的路。如果您碰巧在您确实需要使用集合但不允许出于某种原因声明自己的收集类型(即您使用读取的读取),那么能够使用ODCI收集类型可能会很方便 - 仅数据库)。不过,总的来说,声明自己的收藏类型(可以给出更有用的名称,然后您可以像模式中的所有其他对象一样管理它们更有意义。
Declaring your own collection type is pretty easy and definitely the way to go. Being able to use the ODCI collection types can be handy if you happen to be in a situation where you really need to use a collection but you're not allowed to declare your own collection type for some reason (i.e. you're using a read-only database). In general, though, it makes vastly more sense to declare your own collection types (which can be given more informative names and which you can then manage just like all the other objects in the schema.