在 cx_Oracle 中调用自定义函数
Call a custom function inside cx_Oracle
我在 Oracle Locator 中有一个自定义函数,我将在 cx_Oracle 中使用此函数将我的 SDO_Geometry 转换为 GeoJSON!
import cx_Oracle
import json
connection = cx_Oracle.Connection("TEST_3D/limo1013@10.40.33.160:1521/sdetest")
cursor = connection.cursor()
cursor.execute("""SELECT a.id AS building_nr, c.Geometry AS geometry, d.Classname AS polygon_typ FROM building a, THEMATIC_SURFACE b, SURFACE_GEOMETRY c, OBJECTCLASS d WHERE a.grid_id_400 = 4158 AND a.id = b.BUILDING_ID AND b.LOD2_MULTI_SURFACE_ID = c.ROOT_ID AND c.GEOMETRY IS NOT NULL AND b.OBJECTCLASS_ID = d.ID""")
obj = cursor.fetchone()
obj = obj[1]
print obj
result = cursor.callfunc('sdo2geojson', cx_Oracle.OBJECT, [obj])
我的对象看起来像:cx_Oracle.OBJECT。
此函数在 SQLdeveloper 中运行。
当我调用该函数时出现以下错误:cx_Oracle.NotSupportedError: Variable_TypeByValue(): 未处理的数据类型 cx_Orac
le.OBJECTVAR
我哪里做错了???
此功能在当前未发布的 cx_Oracle 版本中可用。您可以从 https://bitbucket.org/anthony_tuininga/cx_oracle.
获取源代码
我在 Oracle Locator 中有一个自定义函数,我将在 cx_Oracle 中使用此函数将我的 SDO_Geometry 转换为 GeoJSON!
import cx_Oracle
import json
connection = cx_Oracle.Connection("TEST_3D/limo1013@10.40.33.160:1521/sdetest")
cursor = connection.cursor()
cursor.execute("""SELECT a.id AS building_nr, c.Geometry AS geometry, d.Classname AS polygon_typ FROM building a, THEMATIC_SURFACE b, SURFACE_GEOMETRY c, OBJECTCLASS d WHERE a.grid_id_400 = 4158 AND a.id = b.BUILDING_ID AND b.LOD2_MULTI_SURFACE_ID = c.ROOT_ID AND c.GEOMETRY IS NOT NULL AND b.OBJECTCLASS_ID = d.ID""")
obj = cursor.fetchone()
obj = obj[1]
print obj
result = cursor.callfunc('sdo2geojson', cx_Oracle.OBJECT, [obj])
我的对象看起来像:cx_Oracle.OBJECT。 此函数在 SQLdeveloper 中运行。
当我调用该函数时出现以下错误:cx_Oracle.NotSupportedError: Variable_TypeByValue(): 未处理的数据类型 cx_Orac le.OBJECTVAR
我哪里做错了???
此功能在当前未发布的 cx_Oracle 版本中可用。您可以从 https://bitbucket.org/anthony_tuininga/cx_oracle.
获取源代码