Aileen, With the TRUNCATE option, do not use –append since append will disable the use of layer creation options.
Use ogr2ogr -s_srs "EPSG:27700" -t_srs "EPSG:27700" -f OCI OCI::xxxxx/xxxx@XE PG:"dbname=postgis active_schema=planning host=localhost user=yyyy password=yyyy!" open_country -nln open_country3 -lco TRUNCATE=yes Mike -- Michael Smith Remote Sensing/GIS Center US Army Corps of Engineers From: Aileen Heal <aileenh...@astuntechnology.com<mailto:aileenh...@astuntechnology.com>> Date: Friday, June 20, 2014 at 7:51 AM To: "gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>" <gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>> Subject: [EXTERNAL] [gdal-dev] How to use TRUNCATE lco with Oracle Spatial driver Resent-From: Michael Smith <michael.sm...@usace.army.mil<mailto:michael.sm...@usace.army.mil>> Can any one provide an example of how to use the TRUNCATE lco for the Oracle Spatial driver. According to the docs. TRUNCATE: This may be "YES" to force the existing table to be reused, but to first truncate all records in the table, preserving indexes or dependencies. Which is exactly what I want, but every time I try to use it I get warnings or errors. e.g. First create a simple table. ogr2ogr -overwrite -s_srs "EPSG:27700" -t_srs "EPSG:27700" -f OCI OCI:xxxxx/xxxx@XE PG:"dbname=postgis active_schema=planning host=localhost user=yyyy password=yyyy" open_country -lco LAUNDER=yes -lco GEOMETRY_NAME=GEOLOC -nln open_country3 so I tried using append with TRUNCATE lco. ogr2ogr -append -s_srs "EPSG:27700" -t_srs "EPSG:27700" -f OCI OCI::xxxxx/xxxx@XE PG:"dbname=postgis active_schema=planning host=localhost user=yyyy password=yyyy!" open_country -nln open_country3 -lco TRUNCATE=yes which resulted in the the following WARNING: Layer creation options ignored since an existing layer is being appended to. The data is appended and the table is not truncated. So I tried this: ogr2ogr -overwrite -s_srs "EPSG:27700" -t_srs "EPSG:27700" -f OCI OCI:xxxxx/xxxx@XE PG:"dbname=postgis active_schema=planning host=localhost user=yyyy password=yyyy" open_country -lco LAUNDER=yes -lco GEOMETRY_NAME=GEOLOC -lco TRUNCATE=yes -nln open_country3 and I get the following errors ERROR 1: ORA-00942: table or view does not exist in TRUNCATE TABLE "OPEN_COUNTRY3" ERROR 1: ORA-04043: object OPEN_COUNTRY3 does not exist in OCIDescribeAny ERROR 1: ORA-04043: object "OPEN_COUNTRY3" does not exist in OCIDescribeAny ERROR 1: ORA-04043: object "OPEN_COUNTRY3" does not exist in OCIDescribeAny ERROR 1: ORA-04043: object "OPEN_COUNTRY3" does not exist in OCIDescribeAny ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "DISPLAYNAM" VARCHAR2(150) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "POLICY_REF" VARCHAR2(100) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "LAYER_NO" NUMBER(10) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "AREA_HA" NUMBER(24,15) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "TEXT_REF" VARCHAR2(20) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "LAYER_NAME" VARCHAR2(50) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "SETTLEMENT" VARCHAR2(40) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "NO_UNITS" NUMBER(10) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "MI_STYLE" VARCHAR2(254) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "MI_PRINX" NUMBER(10) ERROR 1: ORA-00942: table or view does not exist in ALTER TABLE OPEN_COUNTRY3 ADD "DISPLAYNAME" VARCHAR2(150) So it appears the -overwrite is dropping the table and then trying to truncate it hence the errors. So I try this ogr2ogr -s_srs "EPSG:27700" -t_srs "EPSG:27700" -f OCI OCI::xxxxx/xxxx@XE PG:"dbname=postgis active_schema=planning host=localhost user=yyyy password=yyyy" open_country -nln open_country3 -lco TRUNCATE=yes And I get the following. FAILED: Layer open_country3 already exists, and -append not specified. Consider using -append, or -overwrite. ERROR 1: Terminating translation prematurely after failed translation of layer open_country (use -skipfailures to skip errors) Not sure what to try next. TIA [https://astuntechnology.com/media/website/images/library/supporting_badge_small.png]<https://astuntechnology.com/ishare/2014-enterprise-gis-roadshows/>
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev