<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:16px"><div id="yiv9149702614"><div id="yui_3_16_0_1_1429606991802_6175"><div id="yui_3_16_0_1_1429606991802_6174" style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:16px;"><div id="yiv9149702614"><div id="yiv9149702614yui_3_16_0_1_1429606991802_4990"><div id="yiv9149702614yui_3_16_0_1_1429606991802_4989" style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:16px;"><div id="yiv9149702614yui_3_16_0_1_1429606991802_4988"><div style="" class="" dir="ltr" id="yiv4916448251yui_3_16_0_1_1429605692372_2428">Hello all,</div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2475" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2476" dir="ltr">I am using ogr2ogr OCI driver to convert an Oracle table to a shape file. The command I am using is (it works perfectly):<br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2532" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2527" dir="ltr">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" <br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2531" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2592" dir="ltr">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:</div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2590" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2591" dir="ltr">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'"</div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2629" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2628" dir="ltr">and I am getting the following error message:</div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2627" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2636" dir="ltr">layer names ignored in combination with -sql.<br style="" class="">ERROR 1: Failed to create file .shp file.<br style="" class="">ERROR 4: Failed to open Shapefile `3011\SELECT * FROM TABLE WHERE DETAILTYPE = 'Something'.shp'.<br style="" class=""><br style="" class="">ERROR 1: Terminating translation prematurely after failed<br style="" class="">translation from sql statement.</div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2808" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2807" dir="ltr">How can I get ogr2ogr to work with -sql?<br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2626" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2548" dir="ltr">I am using GDAL 1.11.1, released 2014/09/24 on Windows 64-bits.</div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2771" dir="ltr"><br style="" class=""></div><div style="" class="" id="yiv4916448251yui_3_16_0_1_1429605692372_2769" dir="ltr">Thanks in advance</div>Ammar<div id="yui_3_16_0_1_1429606991802_6213" style="" class="" dir="ltr"><br style="" class=""></div></div></div></div></div></div></div></div></div></body></html>