ORACLE SDO_GEOMETRY ToString()?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8883069/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:32:19  来源:igfitidea点击:

ORACLE SDO_GEOMETRY ToString()?

.netsqloracleplsqloracle-spatial

提问by CSharpened

I have a .Net system that I am writing which needs to be able to retrieve an oracle geometry field from the database. Is there any way in my SQL statement to cast the geometry type to a string so that I can deal with it on my .Net side. At the moment I cannot get the data out as it is not a valid datatype to put into my OLEDB reader so it must be converted database side.

我有一个我正在编写的 .Net 系统,它需要能够从数据库中检索一个 oracle 几何字段。在我的 SQL 语句中有什么方法可以将几何类型转换为字符串,以便我可以在我的 .Net 端处理它。目前我无法获取数据,因为它不是放入我的 OLEDB 阅读器的有效数据类型,因此必须转换数据库端。

select CS_BOUNDS from MDSYS.CS_SRS where SRID = 4326

Thanks

谢谢

回答by Vincent Malgrat

You could use the Get_WKTmethod:

您可以使用以下Get_WKT方法:

Returns the well-known text (WKT) format (explained in Section 6.7.1.1) of a geometry object.

返回几何对象的众所周知的文本 (WKT) 格式(在第 6.7.1.1 节中解释)。

The documentation gives the following example:

文档给出了以下示例:

SELECT c.shape.Get_WKT()
  FROM cola_markets c WHERE c.name = 'cola_b';

C.SHAPE.GET_WKT()                                                               
--------------------------------------------------------------------------------
POLYGON ((5.0 1.0, 8.0 1.0, 8.0 6.0, 5.0 7.0, 5.0 1.0)) 

The return type is CLOB.

返回类型是 CLOB。