1

I have 2 varchars like:

20160316131824
20160316080002

How can I subtract to see if there is more than 24 hours of difference between the 2 values?

I tried using the symbol - but it gives me an error. What is the best way?

1
1

Here is the sample query to convert the given varchar2 value to date and calculated the difference in hour.

select (to_date('20160316124052', 'yyyy-mm-dd hh24:mi:ss')-to_date('20160316080002', 'yyyy-mm-dd hh24:mi:ss'))*24 DateAndTime from dual;

Update

SELECT (sysdate-to_date(START_TIME,'YYYYMMDDHH24MISS'))*24 FROM LOGGING WHERE NAME='TERR_PAST' AND UPPER(STATUS) = 'EXECUTED';
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.