Unary SQL Sequence Functions

The following unary functions take a single input sequence, apply the specified operation and return a sequence of the same type.

seq_abs( input )

Return the sequence of absolute values of the input sequence's elements

seq_neg( input )

Return the sequence of the negative of the input sequence's elements

Example

Following is an example code snippet demonstrating the unary operator functions:

     
    -- seq_abs, seq_neg
            
     
    INSERT INTO SimpleSequence(testNumber,iVal1)
        VALUES(1,'{-3,-2,-1,0,1,2,3}');
     
    SELECT iVal1, seq_abs(iVal1) AS "abs" FROM SimpleSequence WHERE testNumber = 1;
    SELECT iVal1, seq_neg(iVal1) AS "neg" FROM SimpleSequence WHERE testNumber = 1;
     
    iVal1{}
    abs{}
    ---------------------------------------------------------
    {-3, -2, -1, 0, 1, 2, 3}
    {3, 2, 1, 0, 1, 2, 3}
     
    iVal1{}
    neg{}
    ---------------------------------------------------------
    {-3, -2, -1, 0, 1, 2, 3}
    {3, 2, 1, 0, -1, -2, -3}