SQL Sequence Map Function

The seq_map() function maps elements from the input sequence to the result sequence according to the positions specified in the second argument. Note that the second argument must be of type mco_seq_no_t (uint8). Note that the values 10 and 30 in the result sequence correspond to the positions (zero-based) specified in the ui8 sequence.

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

 
    INSERT INTO SimpleSequence(testNumber,iVal1,ui8)
    VALUES(3,'{10,20,30}','{0,2}');
     
    SELECT iVal1,ui8,seq_map(iVal1,ui8) AS "map" FROM SimpleSequence WHERE testNumber=3;
     
    iVal1
    ui8
    map
    ---------------------------------
    {10, 20, 30}
    {0, 2}
    {10, 30}
     

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 5