Compare() function

The Compare( ) function compares two node types to determine if they are the same.

Returns: -1, 0, or 1.
-1
The first argument is less than the second.
0
The arguments are equal.
1
The first argument is greater than the second.

Syntax

compare(node1, node2)
node1
The first node to compare.
node2
The node to which the first argument is compared

Example

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

SELECT n1.col1, n2.col1, Compare (n1.col1, n2.col1)
FROM nodetab1 n1, nodetab1 n2;
 
col1          1.0 
col1          1.0 
(expression)  0

col1          2.0 
col1          1.0 
(expression)  1

col1          1.0 
col1          2.0 
(expression)  -1