This example finds approximate average using aggregate average that
returns average every 5 record. Average is defined using
O-SQL-AG
using the spec given in subsection 4.2. The approximate average is
returned when the change in average for the last 10 records is 0.03% or less.
The following PL/SQL procedure computes the approximate average, using the average aggregate.
Following is a call to approx_avg. (These commands were given at the sqlplus command line prompt)
The table used contained 100,000 randomly generated 100,000 records. The actual average for the given data was 50045.8429. The approximate average was computed within an error margin of 0.34% after 735 out the 100,000 records were visited.