SQL Sequence Subseq Function

The seq_subseq() function is used to extract a segment of the input sequence by specifying integer position arguments “from” and “to”.

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

 
    SELECT symbol, seq_subseq(seq_search(day, 20130101, 20131231),1,4) as "2013_1-4"
    FROM Quote WHERE symbol='SYM0';
     
    symbol
    2013_1-4{}
    -------------------------------------------------
    SYM0
    {20130104, 20130106, 20130110, 20130123}
     

The example above returns the sequence containing elements 1 through 4 of the input sequence which contains the day values for year 2013.

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:

     
    g 11