Skip to content

Error: ORA-00932 with Oracle and mapserver 8.6 build from 27.4.2026 #7489

Open

Description

@DanielKnoop

I encountered an error with mapserver and oracle after updating from mapserver 8.6 build from 29.1.2026 to mapserver 8.6 build from 27.4.2026.
I use the stable build (daily) from gisinternals.com

I think it has to do with this issue: #7463
(but I'm not sure, there is a second commit to oraclespatial.c in the timerange)

the original query from mapserver to the database was:
SELECT "ART", "LEITUNGSART", "STATUS", FID,rownum, GEOM FROM (select FID,GEOM,ART,LEITUNGSART,STATUS from FW_STRANG) WHERE SDO_FILTER( GEOM, MDSYS.SDO_GEOMETRY(2003, :srid, NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),:ordinates ),'querytype=window') = 'TRUE'

after the update, the error logged is:

[Tue Apr 28 13:11:22 2026].628000 Error: ORA-00932: Inkonsistente Datentypen: %s erwartet, %s erhalten
. Query statement: SELECT btmp.*, ROWNUM FROM (SELECT "ART", "LEITUNGSART", "STATUS", FID,GEOM FROM (select FID,GEOM,ART,LEITUNGSART,STATUS from FW_STRANG) WHERE SDO_FILTER( GEOM, MDSYS.SDO_GEOMETRY(2003, :srid, NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),:ordinates ),'querytype=window') = 'TRUE' ) btmp  . Check your data statement.msOracleSpatialLayerWhichShapes()
[Tue Apr 28 13:11:22 2026].628000 msOracleSpatialLayerWhichShapes(): OracleSpatial error. Check your data statement and server logs

btmp was introduced with the issue i mentioned.

the layer definition (i.e.) is as followed:

  LAYER
    NAME "FW_STRANG"
    STATUS ON
    METADATA
      "wms_title" "Strang"
      "wms_layer_group" "/leitung"
      "wms_group_title" "Leitung"
    END
    TYPE LINE
    CONNECTIONTYPE PLUGIN
    PLUGIN "oracle"
    CONNECTION "WAERME/XXX@tnsname"
    PROCESSING "CLOSE_CONNECTION=DEFER"
    DATA "GEOM from (select FID,GEOM,ART,LEITUNGSART,STATUS from FW_STRANG) USING UNIQUE FID SRID 25832"
    EXTENT 366712 5906795 401562 5921118
    MINSCALEDENOM 50
    #MAXSCALEDENOM 5000
    SIZEUNITS METERS
    CLASS
      NAME "Vorlauf Anschlussltg Planung"
      #Display Model Expression ART = 1 AND  LEITUNGSART  =  2  AND  STATUS  =  3
      EXPRESSION ((([ART] = 1) AND ([LEITUNGSART] = 2)) AND ([STATUS] = 3))
      MINSCALEDENOM 50
      MAXSCALEDENOM 5000
      STYLE
        WIDTH 0.12
        COLOR "#FF00FFFF"
        LINECAP ROUND
        LINEJOIN MITER
        PATTERN
          0 0.24 0.12 0.24 0 0.24 0
        END
      END
    END

... many classes more ...

  END

Activity

  1. msmitherdc commented on Apr 28, 2026

    @msmitherdc
    Contributor
  2. msmitherdc commented on Apr 28, 2026

    @msmitherdc
    Contributor
  3. DanielKnoop commented on Apr 29, 2026

    @DanielKnoop
    Author

    Hi Mike,
    thanks for your response. I've tested a lot, Its not possible for me to get data from oracle with the new build.
    This is the DEBUG 5 log from the layer. If I execute the query with sql-Developer it works fine. So the query should not be the problem. Any idea? FID is NUMBER(10).

    [Wed Apr 29 07:37:34 2026].356000 msOracleSpatialLayerOpen called with: GEOM FROM FW_STRANG USING UNIQUE FID SRID 25832 (Layer pointer 000002BE8F387AB0)
    [Wed Apr 29 07:37:34 2026].356000 msConnPoolRequest(FW_STRANG, WAERME/XXX@tnsname) -> got 000002BE8F35FFC0
    [Wed Apr 29 07:37:34 2026].362000 msOracleSpatialLayerFreeItemInfo was called.
    [Wed Apr 29 07:37:34 2026].362000 msOracleSpatialLayerWhichShapes was called.
    [Wed Apr 29 07:37:34 2026].362000 msOracleSpatialLayerWhichShapes. Using this Sql to retrieve the data: SELECT btmp.*, ROWNUM FROM (SELECT FID,GEOM FROM FW_STRANG WHERE SDO_FILTER( GEOM, MDSYS.SDO_GEOMETRY(2003, :srid, NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),:ordinates ),'querytype=window') = 'TRUE' ) btmp 
    [Wed Apr 29 07:37:34 2026].362000 msOracleSpatialLayerWhichShapes. Bind values: srid:25832   minx:382480.231798   miny:5912957.011887  maxx:385793.768202   maxy:5914954.988113 
    [Wed Apr 29 07:37:34 2026].362000 msOracleSpatialLayerWhichShapes getting ordinate definition.
    [Wed Apr 29 07:37:34 2026].363000 msOracleSpatialLayerWhichShapes converting to OCIColl.
    [Wed Apr 29 07:37:34 2026].363000 msOracleSpatialLayerWhichShapes bind by name and object.
    [Wed Apr 29 07:37:34 2026].363000 msOracleSpatialLayerWhichShapes name and object now bound.
    [Wed Apr 29 07:37:34 2026].369000 Error: ORA-00932: Inkonsistente Datentypen: %s erwartet, %s erhalten
    . Query statement: SELECT btmp.*, ROWNUM FROM (SELECT FID,GEOM FROM FW_STRANG WHERE SDO_FILTER( GEOM, MDSYS.SDO_GEOMETRY(2003, :srid, NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),:ordinates ),'querytype=window') = 'TRUE' ) btmp  . Check your data statement.msOracleSpatialLayerWhichShapes()
    [Wed Apr 29 07:37:34 2026].369000 msOracleSpatialLayerWhichShapes(): OracleSpatial error. Check your data statement and server logs
    

    Thanks,
    Daniel

  4. jratike80 commented on Apr 29, 2026

    @jratike80

    The error comes from the Oracle side but it is odd that it does not report the real values for what it expected and what it got.
    https://docs.oracle.com/en/error-help/db/ora-00932/

  5. msmitherdc commented on Apr 29, 2026

    @msmitherdc
    Contributor

    @jmckenna I think we should revert #7464 and its backport. Evidently my quick testing was insufficient and this is yielding invalid queries.

  6. jmckenna commented on Apr 29, 2026

    @jmckenna
    Member

    thanks @DanielKnoop and @msmitherdc, reverted.

  7. jmckenna commented on Apr 29, 2026

    @jmckenna
    Member

    @JamieIdox please re-submit a new pull request (regarding the reverted changes in #7464), that hopefully also includes a fix for this subquery issue discussed here. Thanks again.

  8. msmitherdc commented on Apr 29, 2026

    @msmitherdc
    Contributor

    @jmckenna thanks for doing this

  9. JamieIdox commented on Apr 30, 2026

    @JamieIdox
    Contributor

    I think the issue is that the code is still assuming that the last field is the spatial field, note numitemsinselect + 1 here:

                      /* define spatial position adtp ADT object */
                      OCIDefineByPos(sthand->stmthp, &adtp, hand->errhp,
                                     (ub4)numitemsinselect + 1, (dvoid *)0, (sb4)0,
                                     SQLT_NTY, (dvoid *)0, (ub2 *)0, (ub2 *)0,
                                     (ub4)OCI_DEFAULT)) &&
    

    (All other field appear to be defineds as SQLT_STR above these lines.)

    If this is the case I am surprised that @msmitherdc's test did not surface it as as far as I can see it would always be an issue.

    If we still want to keep the btmp subquery we could handle this two ways:

    1. Keep the query as it is now but adjust the code that references indexes. This is probably the simplest solution but involves more code change.
    2. Name the fields in the outer subquery, keeping them in the same order. We could probably do this by copying the string containing the field list from the inner subquery, but IMHO this is more complex.
  10. JamieIdox commented on Apr 30, 2026

    @JamieIdox
    Contributor

    I think uniqueid is also an issue. It is set at number_of_columns which is automatically either the added KEY column, or rownum, eg index 3 here:

    a, b, c, OPTIONAL_KEY, rownum, geom
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions