[gdal-dev] ogrinfo and oracle sql expressions, maybe arcsde
Duarte Carreira
DCarreira at edia.pt
Thu Oct 6 14:53:37 EDT 2011
Hi again.
I am trying to determine why I cannot get any sql queries to work against oracle and through arcsde driver.
It seems the sql sentence keeps adding single-quotes to both field and value, which is not valid.
For instance, a simple numeric clause:
Ogrinfo -so -ro -al -sql "SELECT * FROM 'USER.TABLE' WHERE FEATID=1234" "SDE:<connection string>"
Results in errors being reported in the client:
"(...)
using driver `SDE' successful.
Layer name: GDBMAN.SREGA_PERIMETROS_REGA
Geometry: Unknown (any)
ERROR 1: SE_stream_fetch: -51/Underlying DBMS error
Feature Count: -1
OGR_SDE: Loading GDBMAN.SREGA_PERIMETROS_REGA layerinfo.
ERROR 1: SE_stream_fetch: -51/Underlying DBMS error
Layer SRS WKT:
(...)"
In ArcSDE logs I can see this sql query being reported:
WhereClause: "('OBJECTID_1') = (21522)"
Which in turn raises an error in Oracle, since single-quotes are meant for values and not for field names. For field names oracle allows double-quotes. So it should really be: ("OBJECTID_2")=(21522).
Then I tried a string query. And that doesn't work either... I can't figure out how to build a sql where clause in ogr with a string field that works...
So, has anyone any successful experience with ogr -sql queries in Oracle or ArcSDE? Any tips? I'm not sure where the error happens, either in sde driver or ogr sql parser...
Thanks,
Duarte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111006/a4e10c43/attachment.html
More information about the gdal-dev
mailing list