Figure 2-3 illustrates the rectangle that represents cola_a in the example in Simple Example: Inserting_ Indexing_ and Querying Spatial Data.
In the SDO_GEOMETRY definition of the geometry illustrated in Figure 2-3:
SDO_GTYPE = 2003. The 2 indicates two-dimensional, and the 3 indicates a polygon.
SDO_SRID = NULL.
SDO_POINT = NULL.
SDO_ELEM_INFO = (1, 1003, 3). The final 3 in 1,1003,3 indicates that this is a rectangle. Because it is a rectangle, only two ordinates are specified in SDO_ORDINATES (lower-left and upper-right).
SDO_ORDINATES = (1,1, 5,7). These identify the lower-left and upper-right ordinates of the rectangle.
Example 2-6 shows a SQL statement that inserts the geometry illustrated in Figure 2-3 into the database.
Example 2-6 SQL Statement to Insert a Rectangle
INSERT INTO cola_markets VALUES(
1,
'cola_a',
SDO_GEOMETRY(
2003, -- two-dimensional polygon
NULL,
NULL,
SDO_ELEM_INFO_ARRAY(1,1003,3), -- one rectangle (1003 = exterior)
SDO_ORDINATE_ARRAY(1,1, 5,7) -- only 2 points needed to
-- define rectangle (lower left and upper right) with
-- Cartesian-coordinate data
)
);