declare
l_now timestamp := systimestamp;
l_end_time timestamp;
l_sec number;
begin
l_sec := apex_application.g_x01;
l_end_time := l_now + numtodsinterval (l_sec, 'second');
while(l_end_time > l_now) loop
l_now := systimestamp;
end loop;
apex_json.open_object;
apex_json.write('success', true);
apex_json.write('x01', l_sec);
apex_json.close_object;
exception
when others then
apex_json.open_object;
apex_json.write('success', false);
apex_json.write('message', sqlerrm);
apex_json.close_object;
end;