The following comparison operators functions take two input sequences, left and right, and produce the Boolean result sequence result.
If the two input sequence arguments are of different lengths the operation will be performed on only the number of elements in the shorter of the two sequences.
seq_eq( left, right ) The element of the result sequence is true
for corresponding elements that are equal in left and right sequences; otherwisefalse
seq_ne( left, right ) The element of the result sequence is true
for corresponding elements that are not equal in left and right sequences; otherwisefalse
seq_gt( left, right ) The element of the result sequence is true
for corresponding elements where the left element is greater than the right; otherwisefalse
seq_ge( left, right ) The element of the result sequence is true
for corresponding elements where the left element is greater than or equal to the right; otherwisefalse
seq_lt( left, right ) The element of the result sequence is true
for corresponding elements where the left element is less than the right; otherwisefalse
seq_le( left, right ) The element of the result sequence is true
for corresponding elements where the left element is less than or equal to the right; otherwisefalse
Example
Following is an example code snippet demonstrating the comparison operator functions:
-- seq_eq, seq_ne, seq_gt, seq_ge, seq_lt, seq_le INSERT INTO SimpleSequence(testNumber,iVal1,iVal2) VALUES(3,'{42,-13,27,19}','{42,-12,26,20}'); SELECT iVal1,iVal2,seq_eq(iVal1,iVal2) AS "eq" FROM SimpleSequence WHERE testNumber=3; SELECT iVal1,iVal2,seq_ne(iVal1,iVal2) AS "ne" FROM SimpleSequence WHERE testNumber=3; SELECT iVal1,iVal2,seq_gt(iVal1,iVal2) AS "gt" FROM SimpleSequence WHERE testNumber=3; SELECT iVal1,iVal2,seq_ge(iVal1,iVal2) AS "ge" FROM SimpleSequence WHERE testNumber=3; SELECT iVal1,iVal2,seq_lt(iVal1,iVal2) AS "lt" FROM SimpleSequence WHERE testNumber=3; SELECT iVal1,iVal2,seq_le(iVal1,iVal2) AS "le" FROM SimpleSequence WHERE testNumber=3; iVal1{} iVal2{} eq{} ------------------------------------------------------------ {42, -13, 27, 19} {42, -12, 26, 20} {1, 0, 0, 0} iVal1{} iVal2{} ne{} ------------------------------------------------------------ {42, -13, 27, 19} {42, -12, 26, 20} {0, 1, 1, 1} iVal1{} iVal2{} gt{} ------------------------------------------------------------ {42, -13, 27, 19} {42, -12, 26, 20} {0, 0, 1, 0} iVal1{} iVal2{} ge{} ------------------------------------------------------------ {42, -13, 27, 19} {42, -12, 26, 20} {1, 0, 1, 0} iVal1{} iVal2{} lt{} ------------------------------------------------------------ {42, -13, 27, 19} {42, -12, 26, 20} {0, 1, 0, 1} iVal1{} iVal2{} le{} ------------------------------------------------------------ {42, -13, 27, 19} {42, -12, 26, 20} {1, 1, 0, 1}