35.80 SDO_UTIL.VALIDATE_WKBGEOMETRY
Format
SDO_UTIL.VALIDATE_WKBGEOMETRY( geometry IN BLOB ) RETURN VARCHAR2;
Description
Validates the input geometry, which is in the standard well-known binary (WKB) format; returns the string TRUE
if the geometry is valid or FALSE
if the geometry is not valid.
Usage Notes
Note:
SDO_UTIL.VALIDATE_WKBGEOMETRY function is not supported in Oracle Autonomous Database Serverless deployments.To be valid, the input geometry must be in the well-known binary (WKB) format, as defined by the Open Geospatial Consortium and the International Organization for Standardization (ISO).
This function is patterned after the SQL Multimedia recommendations in ISO 13249-3, Information technology - Database languages - SQL Multimedia and Application Packages - Part 3: Spatial.
To validate a geometry in the well-known text (WKT) format, use the SDO_UTIL.VALIDATE_WKTGEOMETRY function.
Examples
The following example shows conversion to and from WKB and WKT format, and validation of WKB and WKT geometries. (The example uses the definitions and data from Simple Example: Inserting_ Indexing_ and Querying Spatial Data, specifically the cola_b
geometry from the COLA_MARKETS table.)
DECLARE wkbgeom BLOB; wktgeom CLOB; val_result VARCHAR2(5); geom_result SDO_GEOMETRY; geom SDO_GEOMETRY; BEGIN SELECT c.shape INTO geom FROM cola_markets c WHERE c.name = 'cola_b'; -- To WBT/WKT geometry wkbgeom := SDO_UTIL.TO_WKBGEOMETRY(geom); wktgeom := SDO_UTIL.TO_WKTGEOMETRY(geom); DBMS_OUTPUT.PUT_LINE('To WKT geometry result = ' || TO_CHAR(wktgeom)); -- From WBT/WKT geometry geom_result := SDO_UTIL.FROM_WKBGEOMETRY(wkbgeom); geom_result := SDO_UTIL.FROM_WKTGEOMETRY(wktgeom); -- Validate WBT/WKT geometry val_result := SDO_UTIL.VALIDATE_WKBGEOMETRY(wkbgeom); DBMS_OUTPUT.PUT_LINE('WKB validation result = ' || val_result); val_result := SDO_UTIL.VALIDATE_WKTGEOMETRY(wktgeom); DBMS_OUTPUT.PUT_LINE('WKT validation result = ' || val_result); END;/ To WKT geometry result = POLYGON ((5.0 1.0, 8.0 1.0, 8.0 6.0, 5.0 7.0, 5.0 1.0)) WKB validation result = TRUE WKT validation result = TRUE
Parent topic: SDO_UTIL Package (Utility)