Hello all,
I am using ogr2ogr OCI driver to convert an Oracle table to a shape file. The 
command I am using is (it works perfectly):

ogr2ogr 3011 -f "ESRI Shapefile" OCI:"user/password@(DESCRIPTION = 
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 
1521)))(CONNECT_DATA = (SID =MY_SID))):TABLE" 

Now, I am trying to use the -sql option so that to retrieve a table only if the 
condition is true but I am having trouble getting the command to work. The 
command I'm using is:
ogr2ogr 3011 -f "ESRI Shapefile" OCI:"user/password@(DESCRIPTION = 
(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 
1521)))(CONNECT_DATA = (SID =MY_SID))):TABLE"  -sql "SELECT * FROM TABLE WHERE 
DETAILTYPE = 'Something'"
and I am getting the following error message:
layer names ignored in combination with -sql.
ERROR 1: Failed to create file .shp file.
ERROR 4: Failed to open Shapefile `3011\SELECT * FROM TABLE WHERE DETAILTYPE = 
'Something'.shp'.

ERROR 1: Terminating translation prematurely after failed
translation from sql statement.
How can I get ogr2ogr to work with -sql?

I am using GDAL 1.11.1, released 2014/09/24 on Windows 64-bits.
Thanks in advanceAmmar
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to