The
seq_first_int()
andseq_last_int()
functions return the first or last element values in a sequence of integers; likewiseseq_first_real()
, andseq_last_real()
return the first and last values for a sequence of real values.Note that
seq_first_int()
andseq_last_int()
require an integer sequence in input and return the first and last integer value in the sequence. Likewiseseq_first_real()
andseq_last_real()
require a sequence of real values in input and return the first and last real value.Following is an example script demonstrating the
seq_first_int()
,seq_last_int()
,seq_first_real()
andseq_last_real()
functions:INSERT INTO SimpleSequence(testNumber,iVal1,fVal1) VALUES(2,'{-3,-2,-1,0,1,2,3}','{11.1,17.7,-23.3,42.5}'); SELECT seq_first_int(iVal1) AS "first_int", seq_last_int(iVal1) AS "last_int", seq_first_real(fVal1) AS "first_real", seq_last_real(fVal1) AS "last_real" FROM SimpleSequence WHERE testNumber = 2; first_int last_int first_real last_real --------------------------------------------------------- -3 3 11.100000 42.500000Sample 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 1