SQL Sequence Reverse Function

The seq_reverse() function returns a result sequence with the input sequence elements in reverse order.

Following is an example script demonstrating the seq_reverse() function:

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

Sample script

A sample script to demonstrate this select statement using xSQL can be run from the samples/xsql/scripts/financial directory with the following command:

     
    f 2