[Gdal-dev] ORACLE driver fails to fetch a VARCHAR2(4000) column

Frank Warmerdam warmerdam at pobox.com
Wed Oct 27 23:05:33 EDT 2004


Petteri Packalen wrote:
> Hi,
> 
> I encountered some problems when trying to convert ORACLE table to some
> other format by using ogr2ogr. The table has a column of type
> VARCHAR2(4000). There seems to be some sort of buffer problem relating
> long text fields.
>
> When I give a command like "ogr2ogr -f "ESRI Shapefile"
> out_kohteet OCI:user/passw at db KOHTEET" I get a message "ERROR 1:
> ORA-01406: fetched column value was truncated in OCIStmtFetch". The
> shapefile is created but it is empty. I don't actually need this
> VARCHAR2(4000) column. I know that the maximum length of the string in dbf
> file is 254 characters. Anyway, it doesn't help if I try to restrict the
> columns fetched by using the switch "-select". It still produces the same
> error code. Also the geometry type in created shapefile is not correct
> ('line' instead of (2D) 'point'). I assume that in this case OGR first
> fetches all columns from ORACLE and then internally retsricts which
> columns are written to output file. The switch -sql "SELECT attr1, attr2,
> ..." fetches all attributes properly but the geometry type (and actual
> geometries) is still wrong ('line' instead of (2D) 'point'). I assume that
> in this case -sql statement is actually passed to ORACLE because it
> doesn't produce the same error code.

Petteri,

I see in gdal/ogr/ogrsf_frmts/oci/ogrocistatement.cpp in the Execute() method
there is a default buffer width of 256 for fields other than a few specific
types.  I would suggest hacking this to 4500 and see if it helps.  Search
for the line with "nBufWidth = 256".

It is killing me that I don't have an oracle instance running here that I can
work with.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list