5. Geospatial Functions : IsValid
 
Share this page                  
IsValid
ISVALID(Geometry)
Alias: ST_ISVALID
Returns 1 if Geometry is valid, 0 if not, -1 if there is an error. Use this function to validate data after it is loaded.
Result type: integer
Example:
SELECT ISVALID(POLYFROMTEXT('POLYGON((0 0, 0 4, 4 4, 4 0, 0 0))'));
---------
col1
---------
1
---------
 
SELECT ISVALID(POLYFROMTEXT('POLYGON((0 0, 0 4, 4 4, 4 0, 2 6, 0 0))'));
---------
col1
---------
0
---------