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

Petteri Packalen packalen at cs.joensuu.fi
Thu Aug 26 06:58:53 EDT 2004


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.

Software versions are:
  GDAL 1.2.1.0, released 2004/06/23
  Oracle9i Release 9.2.0.4.0

Any hints how to work around the problem?

Best regards,
Petteri

=========================================================================
Petteri Packalén                   "There are two major products that
University of Joensuu               came out of Berkeley: LSD and UNIX.
Faculty of Forestry                 We don't believe this to be a
P.O. Box 111                        coincidence."  -- J.S. Anderson
80101 Joensuu
Finland                            "There still remains a question: Which
e-mail: packalen at cs.joensuu.fi      caused the other?"
=========================================================================




More information about the Gdal-dev mailing list