hello friends !
i want to share with you ,
how to measure service response time or any time duration
in seconds with miliseconds using Oracle .
PB CODE:
RESTClient client
client = create RESTClient
client.SetRequestHeader ("Content-Type", "application/json")
select orascheme.systimestamp_to_char
into :ls_time_from
from dual;
li_SendReturn = client.SendPostRequest(ls_service_url, JWTRequest, ls_Responsebody)
select orascheme.systimestamp_to_char
into :ls_time_to
from dual;
select orascheme.duration_for_systimestamps ( :ls_time_from, :ls_time_to)
into :ld_duration
from dual;
st_duration.text = string(ld_duration)
------------------
ORACLE FUNCTIONS:
function systimestamp_to_char return varchar2 is
v_timestamp varchar2(50);
begin
SELECT to_char(systimestamp, 'YYYY-MM-DD HH24:MI:SS.FF3')
INTO v_timestamp
FROM DUAL;
return v_timestamp;
end;
function duration_for_systimestamps(in_time_from varchar2,
in_time_to varchar2) return number is
v_duration number(5, 3);
begin
begin
select extract(second from diff) seconds
into v_duration
from (select to_timestamp(in_time_to, 'YYYY-MM-DD HH24:MI:SS.FF3') -
to_timestamp(in_time_from, 'YYYY-MM-DD HH24:MI:SS.FF3') diff
from dual);
exception
when others then
null;
end;
return v_duration;
end;