Opened 12 years ago

Closed 8 years ago

#4817 closed defect (wontfix)

OCI driver reports 'ORA-00913: Too many values' when used from C#

Reported by: ivolimmen Owned by: hobu
Priority: normal Milestone:
Component: SWIG (all bindings) Version: 1.9.1
Severity: normal Keywords: OCI, OGR, C#
Cc:

Description

I am a GDAL/OGR user sinds 2009 and have been using the GDAL tool version 1.6.3. I use an Oracle database for storage. I use GDAL from within my application written in .NET using the C# bindings. It has been working perfectly.

I wanted to upgrade to the latest version (1.9.1) but my attempt has been unsuccessful. When using ogr2ogr from the command line to insert a shapefile into the database works. Using GDAL from within my application fails. It took my quite some time but managed to retrieve the debug messages from GDAL so I could see what the OCI driver tries to do (and fails in).

My table has the following structure:

ID                NUMBER(9,0)
FEATURE_ID        NUMBER(9,0)
DOL_ID            NUMBER(9,0)
PJT_ID            NUMBER(9,0)
GEOMETRY          SDO_GEOMETRY
ONTEIGENINGSCODE  NUMBER(1,0)
VAL_RESULT        NUMBER(1,0)

All columns are nullable except for VAL_RESULT but it has a default.

When I add a feature to the layer in my application the driver fails on SyncToDisk method. The error oracle gives is ORA-00913: Too many values. in OCIStmtExecute. The statement it tries to execute is as follows:

{{ INSERT INTO GGF_OGR_GEOM VALUES ( :fid, :geometry, :field_0, :field_1, :field_2, :field_3, :field_4, :field_5) }}

I also find it a bit scary that the statement does not use column names to insert the data, meaning the order of the columns should be the same as oracle reports them (and in this case: it isn't). The values for the parameters (as far as I could find) are:

  • fid = -1 (no id yet)
  • :geometry = SDO_GEOMETRY('POLYGON ((141545 452903,141594 452903,141594 452894,141545 452894,141545 452903))', 28992) (WKT of the geometry)
  • :field_0 = 1947
  • :field_1 = 1
  • :field_2 = 21
  • :field_3 = NULL
  • :field_4 = 0
  • :field_5 = NULL

field_0 containts the value for my sequence a.k.a. the ID, still the FID is added in the query. After some searching I have found that since 1.6.3 there have been some improvements on the OCI driver and I have been trying to find what has changed that broke this. I haven't found anything yet. I have tried adding a column called OGR_FID but this adds an extra column anyway. I also tried setting the config option:

OSGeo.GDAL.Gdal.SetConfigOption("OGR_FID", "ID");

But this also does not work as I expected it, it still reports "too many values".

Extra info: 1.8.1 and 1.9.0 report the same error.

Change History (3)

comment:1 by Jukka Rahkonen, 9 years ago

It would be nice to know what is the situation now with GDAL 1.11 / 2.0. Is the issue still the same, ivolimmen?

in reply to:  1 comment:2 by ivolimmen, 9 years ago

Replying to jratike80:

It would be nice to know what is the situation now with GDAL 1.11 / 2.0. Is the issue still the same, ivolimmen?

I stopped working on the project and never upgraded. Can't say it is fixed or not. If I would develop another application using GDAL I would not use Oracle anyway.

comment:3 by Jukka Rahkonen, 8 years ago

Resolution: wontfix
Status: newclosed

Would need C# developer and someone for testing and we have none. Considered to keep open if somebody else will have similar problems but tickets don't disappear when they are closed.

Note: See TracTickets for help on using tickets.