0

I have two varchar2 columns as follows, and I want to substract and get the difference.

enter image description here

I tried following query, but I get 0.333333333333333 as the value which is not correct and the expected answer should be 8.

select (to_date(a.cf$_end_time_work_hour_1, 'DD/MM/YYYY HH24:MI:SS') - 
to_date(a.cf$_start_time_work_hour_1, 'DD/MM/YYYY HH24:MI:SS')) from 
TEMP_INC_TIME_REG a where rowkey = 'F99B44A0AB2B3392E054028DF90DFD875';

Any idea how to solve this?

1 Answers1

1

For difference between dates, multiply the difference by 24 to get the result in minutes.

select 
  (to_date(a.cf$_end_time_work_hour_1, 'DD/MM/YYYY HH24:MI:SS') - 
  to_date(a.cf$_start_time_work_hour_1, 'DD/MM/YYYY HH24:MI:SS'))*24 
from 
TEMP_INC_TIME_REG a where rowkey = 'F99B44A0AB2B3392E054028DF90DFD875';