DECLARE
result varchar2(100);
BEGIN
select substr((systimestamp - (select date_time from test where id=2945134)), 3,1)
into result
from dual;
dbms_output.put_line(result);
END;
/
But this is a highly dubious thing you are doing. You are relying on implicit datatype conversion (interval
--> varchar
) which will not work properly if your NLS settings change.
You would better use to_char()
to format the resulting interval
to something appropriate.