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
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to