My GIS software has an Oracle 18c object type called ST_GEOMETRY.
The object type has attributes:
The attributes of the spatial type represent the following information:
- Entity: The type of geometric feature stored in the spatial column (linestring, multilinestring, multipoint, multipolygon, point, or polygon), the value of which is a bit mask derived from the st_geom_util stored procedure.
- Numpts: The number of points defining the geometry; for multipart geometries, this includes the separators between each part, one point for each separator.
- Minx, miny, maxx, maxy: The spatial envelope of the geometry
- Area: The area of the geometry
- Len: The perimeter length of the geometry
- SRID: Contains the identifier for the geometry that links it to its associated spatial reference (coordinate system) record in the ST_Spatial_References table
- Points: Contains the byte stream of the point coordinates that define the geometry
I can select an object's attribute using one of two methods:
- Use Oracle's TREAT() function.
select treat(shape as sde.st_geometry).numpts as num_points from a_test_table NUM_POINTS ---------- 37 161
- Or I can simply use an alias:
select a.shape.numpts as num_points from a_test_table a NUM_POINTS ---------- 37 161
Question:
Why is it necessary to use an alias to select an attribute from an Oracle object?
If I were to remove the alias...
select
shape.numpts as num_points
from
a_test_table
Then I would get an error:
ORA-00904: "SHAPE"."NUMPTS": invalid identifier
select (shape).sdo_gtype