set serveroutput on size 1000000 lines 160
declare
cursor c1 is select
sql_id,
child_number,
last_active_time,
substr(sql_text,1,40) as "SQL",
parsing_schema_name,
executions,
rows_processed,
round(elapsed_time/1000000/decode(executions,0,1,executions),6) time
from v$sql where last_active_time>sysdate-interval '5' second and parsing_schema_name='&SCHEMANAME' ;
list c1%rowtype ;
begin
for i in 1..10 loop
dbms_lock.sleep(1);
dbms_output.put_line('=================================') ;
for list in c1 loop
dbms_output.put_line(to_char(SYSDATE,'HH24:MI:SS')||': '||list.sql_id||': '||list.child_number||' executions >> '||list.executions||' << '||list."SQL" ||'-> exec time:'||list.time) ;
exit when c1%notfound;
end loop;
end loop;
end;
/