往oracle中插入geometry的两种方式

方式一(传入的是wkt):
INSERT INTO tablename
  (id, GEOMETRY)
VALUES
  (1,
   SDO_GEOMETRY('LINESTRING (115.48883 36.59252, 115.4887 36.59164)', 8307));
   
方式二(直接传入坐标):
  INSERT INTO tablename
  (ID,  GEOMETRY)
VALUES
  (1,
    SDO_GEOMETRY(2002,
                8307,
                NULL,
                SDO_ELEM_INFO_ARRAY(1, 2, 1),

                SDO_ORDINATE_ARRAY(115.48883, 36.59252, 115.4887, 36.59164)));  


CREATE TYPE sdo_geometry AS OBJECT (
                     SDO_GTYPE   NUMBER,  //前面字符串为字段名;后面字符串为字段类型
                     SDO_SRID     NUMBER,
                     SDO_POINT    SDO_POINT_TYPE,
                     SDO_ELEM_INFO    SDO_ELEM_INFO_ARRAY,
                     SDO_ORDINATES    SDO_ORDINATE_ARRAY); 

你可能感兴趣的:(Oracle)