oracle 11g SDO_ORDINATE
时间: 2023-09-23 11:03:24 浏览: 128
Oracle 11g is a relational database management system developed by Oracle Corporation. It includes a spatial extension known as SDO (Spatial Data Option) which provides support for storing, indexing, and querying spatial data.
SDO_ORDINATE is a data type used in Oracle Spatial to represent the X and Y coordinates of a point in a Cartesian coordinate system. It is part of the SDO_GEOMETRY type, which is used to store geometric objects such as points, lines, and polygons.
The SDO_ORDINATE data type consists of two numbers: the X coordinate and the Y coordinate. These numbers represent the location of a point in a two-dimensional space.
Here is an example of how you can use SDO_ORDINATE to create a point in Oracle Spatial:
```sql
-- Create a table with a spatial column
CREATE TABLE locations (
id NUMBER,
name VARCHAR2(100),
geom MDSYS.SDO_GEOMETRY
);
-- Insert a point into the table
INSERT INTO locations VALUES (
1,
'Sample Point',
MDSYS.SDO_GEOMETRY(
2001, -- Geometry type code for a point
NULL,
MDSYS.SDO_POINT_TYPE(2, 3, NULL),
NULL,
NULL
)
);
-- Query the point
SELECT id, name, geom.SDO_ORDINATES(1) AS x, geom.SDO_ORDINATES(2) AS y
FROM locations;
```
In this example, the SDO_POINT_TYPE function is used to create a point with X coordinate 2 and Y coordinate 3. The point is then stored in the geom column of the locations table.
阅读全文