# ST_Disjoint function

The ST_Disjoint function takes two geometries as input parameters and returns 1 if the given geometries do not intersect. If the geometries do intersect, then 0 (zero) is returned.

If the second geometry is not represented in the same spatial reference system as the first geometry, it will be converted to the other spatial reference system.

If any of the two geometries is null or is empty, then null value is returned.

This function can also be called as a method.

## Parameter

geometry1
A value of type ST_Geometry that represents the geometry that is tested to be disjoint with geometry2.
geometry2
A value of type ST_Geometry that represents the geometry that that is tested to be disjoint with geometry1.

INTEGER

## Examples

Example 1
This code creates several geometries in the SAMPLE_GEOMETRIES table.
``````
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_geoms (id INTEGER, geometry ST_Geometry)

INSERT INTO sample_geoms VALUES
(1, ST_Geometry('polygon((20 30, 30 30, 30 40, 20 40, 20 30))',0))

INSERT INTO sample_geoms VALUES
(2, ST_Geometry('polygon((30 30, 30 50, 50 50, 50 30, 30 30))',0))

INSERT INTO sample_geoms VALUES
(3, ST_Geometry('polygon((40 40, 40 60, 60 60, 60 40, 40 40))',0))

INSERT INTO sample_geoms VALUES
(4, ST_Geometry('linestring(60 60, 70 70)' ,0))

INSERT INTO sample_geoms VALUES
(5, ST_Geometry('linestring(30 30, 40 40)' ,0))

``````
Example 2
This example determines if the first polygon is disjoint from any of the geometries.
``````
SELECT a.id, b.id, ST_Disjoint(a.geometry, b.geometry) DisJoint
FROM sample_geoms a, sample_geoms b
WHERE a.id = 1

``````
Results:
``````
ID          ID          DISJOINT
----------- ----------- -----------
1           1           0
1           2           0
1           3           1
1           4           1
1           5           0

``````
Example 3
This example determines if the third polygon is disjoint from any of the geometries.
``````
SELECT a.id, b.id, ST_Disjoint(a.geometry, b.geometry) DisJoint
FROM sample_geoms a, sample_geoms b
WHERE a.id = 3

``````
Results:
``````
ID          ID          DISJOINT
----------- ----------- -----------
3           1           1
3           2           0
3           3           0
3           4           0
3           5           0

``````
Example 4
This example determines if the second linestring is disjoint from any of the geometries.
``````
SELECT a.id, b.id, ST_Disjoint(a.geometry, b.geometry) DisJoint
FROM sample_geoms a, sample_geoms b
WHERE a.id = 5

``````
Results:
``````
ID          ID          DISJOINT
----------- ----------- -----------
5           1           0
5           2           0
5           3           0
5           4           1
5           5           0

``````