This discussion is archived
2 Replies Latest reply: Aug 13, 2013 8:23 AM by user11219778 RSS

Get gtype from geometry

user11219778 Newbie
Currently Being Moderated

Hi,

 

I am unable to find geometry type from Geometry. I have tried following and getting invalid identifier (ora-00904) error. please help!

 

select geometry.gtype from table1   -- returns invalid identifier

 

same error using

 

select geometry.sdo_gtype from table1

select geometry.sdo_srid from table1

 

however I can query select geometry from table1

 

 


  • 1. Re: Get gtype from geometry
    Barbara Boehmer Oracle ACE
    Currently Being Moderated

    Objects, like those in spacial, require the usage of a table alias to reference their subtypes, as demonstrated below.

     

    SCOTT@orcl12c_11gR2> create table table1 (geometry  sdo_geometry)

      2  /

     

    Table created.

     

    SCOTT@orcl12c_11gR2> insert into table1 values

      2    (MDSYS.SDO_GEOMETRY

      3        (2006,

      4         81989,

      5         NULL,

      6         MDSYS.SDO_ELEM_INFO_ARRAY (1,2,1, 5,2,1, 9,2,1),

      7         MDSYS.SDO_ORDINATE_ARRAY(0,0,1,1, 3,0,2,1, 1,1,2,1)))

      8  /

     

    1 row created.

     

    SCOTT@orcl12c_11gR2> select * from table1

      2  /

     

    GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)

    --------------------------------------------------------------------------------

    SDO_GEOMETRY(2006, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1, 5, 2, 1, 9, 2, 1),

    SDO_ORDINATE_ARRAY(0, 0, 1, 1, 3, 0, 2, 1, 1, 1, 2, 1))

     

     

    1 row selected.

     

    SCOTT@orcl12c_11gR2> select table_alias.geometry.sdo_gtype from table1 table_alias

      2  /

     

    GEOMETRY.SDO_GTYPE

    ------------------

                  2006

     

    1 row selected.

  • 2. Re: Get gtype from geometry
    user11219778 Newbie
    Currently Being Moderated

    Thanks Barbara

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points