SQL/MX 2.x Reference Manual (H06.04+)

SQL/MX Functions and Expressions
HP NonStop SQL/MX Reference Manual540440-003
9-137
Examples of RUNNINGVARIANCE
Return the variance of nonnull values of I1 up to and including the current row:
SELECT RUNNINGVARIANCE (I1) AS VARIANCE_I1
FROM mining.seqfcn
SEQUENCE BY TS;
VARIANCE_I1
-------------------------
0.00000000000000000E+000
2.41098840499999960E+008
2.19099696999999968E+008
1.57851953666666640E+008
1.19374201299999980E+008
--- 5 row(s) selected.
Note that you can use the CAST function for display purposes. For example:
SELECT CAST(RUNNINGVARIANCE (I1) AS DEC (18,3))
FROM mining.seqfcn
SEQUENCE BY TS;
(EXPR)
--------------------
.000
241098840.500
219099697.000
157851953.666
119374201.299
--- 5 row(s) selected.