PL/SQL get averages/min/max/ on

I want to print to screen the averages/min/max of calculated values. the purpose is to calculate the time some request take and then take the average the min/max of those times.

but I do not know how to apply the calculations of average to the elapsed value. you see in my code below.

set serveroutput on set echo off SET VERIFY OFF set heading off SET FEEDBACK OFF set serveroutput on size unlimited set linesize 300 ALTER session SET TIME_ZONE='GMT'; Declare vv_SchemaName VARCHAR2(15); BEGIN vv_SchemaName := Sys_Context('USERENV','CURRENT_SCHEMA'); FOR REQUEST IN ( select a.transaction_id as trans_Id, e.eventcode, e.eventtime, a.time_received, round((e.eventtime - a.time_received) * 86400) as elapsed from request_history_tbl a join eventlog_tbl e on a.transaction_id = e.transaction_id where e.eventtime >= current_timestamp - 2 and e.eventcode = '50' ) LOOP dbms_output.put_line('average_request_time' || ...) -- avg(elapsed) dbms_output.put_line('Min_request_time' || ...) -- min(elapsed) dbms_output.put_line('max_request_time' || ...) --max(elapsed) END LOOP; END; / 

submitted by /u/dan7843292
[link] [comments]

Go to Source of this post
Author Of this post: /u/dan7843292
Title Of post: PL/SQL get averages/min/max/ on
Author Link: {authorlink}