IsDescendant() function

The IsDescendant( ) function lets you determine if a specific node is a descendant of another. This function is the opposite of IsAncestor().

Returns: Boolean

Syntax

IsDescendant(node1, node2)
node1
The node that you want to determine whether it is a descendant of node1.
node2
The parent node for which you want to find a descendant.

Example

CREATE TABLE nodetab1 (col1 node);
INSERT INTO nodetab1 VALUES ('1.0');
INSERT INTO nodetab1 VALUES ('1.1');
INSERT INTO nodetab1 VALUES ('1.1.1');

SELECT  n1.col1, n2.col1, IsDescendant (n1.col1, n2.col1)
FROM    nodetab1 n1, nodetab1 n2;

col1          1.0 
col1          1.0 
(expression)  f

col1          1.1 
col1          1.0 
(expression)  t

col1          1.1.1 
col1          1.0 
(expression)  t

col1          1.0 
col1          1.1 
(expression)  f