SQL Sequence Repeat Function

The seq_repeat() function returns a result sequence containing repeating values from the input sequence. Note that the second argument, a positive integer, specifies the number of times to repeat the values specified in the sequence argument.

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

 
    INSERT INTO SimpleSequence(testNumber,iVal1)
    VALUES(4,'{42}','{17}');
     
    SELECT iVal1,seq_repeat(iVal1,3) AS "repeat" FROM SimpleSequence WHERE testNumber=4;
     
    iVal1{}
    repeat{}
    --------------------
    {42, 17}
    {42, 42, 42, 17, 17, 17}
     

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