The
seq_unique()
function removes repeating values from the result sequence but a value may appear more than once. For example, note that the value 4 in the result set above appears once at the beginning of the sequence where the input sequence has a repeated value, and then again at the second to last element where the single value of 4 is present in the input sequence.Following is an example script demonstrating the
seq_unique()
function:INSERT INTO SimpleSequence(testNumber,iVal1) VALUES(3,'{4,4,7,7,7,5,4,3}'); SELECT iVal1, seq_unique(iVal1) AS "unique" FROM SimpleSequence WHERE testNumber = 3; iVal1{} unique{} ---------------------------------------------------------------------- {4, 4, 7, 7, 7, 5, 4, 3} {4, 7, 5, 4, 3}Sample script
A sample script to demonstrate this
select
statement using xSQL can be run from thesamples/xsql/scripts/financial
directory with the following command:f 2