GetParent() function

The GetParent( ) function returns the parent of a node. If the node does not have a parent NULL is returned.

Returns: node or NULL

Syntax

GetParent(node)
node
The child node whose parent you want to determine.

Example

CREATE TABLE nodetab1 (col1 node);
INSERT INTO nodetab1 VALUES ('1.0');
INSERT INTO nodetab1 VALUES ('1.1.1');
INSERT INTO nodetab1 VALUES ('1.1.2');
INSERT INTO nodetab1 VALUES ('1.1.2.1');
INSERT INTO nodetab1 VALUES ('2.0');

SELECT  col1, GetParent(col1)
FROM    nodetab1;

col1          1.0
(expression)   

col1          1.1.1
(expression)  1.1 

col1          1.1.2
(expression)  1.1 

col1          1.1.2.1
(expression)  1.1.2

col1          2.0
(expression)