Figure 2-7 illustrates a point-only geometry at coordinates (12,14).
In the SDO_GEOMETRY definition of the geometry illustrated in Figure 2-7:
SDO_GTYPE = 2001. The 2 indicates two-dimensional, and the 1 indicates a single point.
SDO_SRID = NULL.
SDO_POINT = SDO_POINT_TYPE(12, 14, NULL). The SDO_POINT attribute is defined using the SDO_POINT_TYPE object type, because this is a point-only geometry.
For more information about the SDO_POINT attribute, see SDO_POINT.
SDO_ELEM_INFO and SDO_ORDINATES are both NULL, as required if the SDO_POINT attribute is specified.
Example 2-10 shows a SQL statement that inserts the geometry illustrated in Figure 2-7 into the database.
Example 2-10 SQL Statement to Insert a Point-Only Geometry
INSERT INTO cola_markets VALUES( 90, 'point_only', SDO_GEOMETRY( 2001, NULL, SDO_POINT_TYPE(12, 14, NULL), NULL, NULL));
You can search for point-only geometries based on the X, Y, and Z values in the SDO_POINT_TYPE specification. Example 2-11 is a query that asks for all points whose first coordinate (the X value) is 12, and it finds the point that was inserted in Example 2-10.
Example 2-11 Query for Point-Only Geometry Based on a Coordinate Value
SELECT * from cola_markets c WHERE c.shape.SDO_POINT.X = 12; MKT_ID NAME ---------- -------------------------------- SHAPE(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES) -------------------------------------------------------------------------------- 90 point_only SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(12, 14, NULL), NULL, NULL)