This content has been marked as final. Show 3 replies
When you substract two date values you will get the difference in days.
So when you need the difference in hours you can use:
hours:= (dt1 - dt2) * 24;
There are several ways to calculate time differences.
for a 'classic example'.
Other functions that you can use are EXTRACT and /or NUMTODSINTERVAL.
Search this forum for many examples.
Too bad you did not post create table and insert into statement, since now we do not know the datatype of your column.
Suggest to read and search the following links, to find more explanations and examples:
http://www.oracle.com/pls/db112/homepage (search box = at upper left corner)
SELECT A.NAME, A.FOR_DT, A.TIME, B.NAME, B.FOR_DT, B.TIME, (A.TIME - B.TIME)*24 DIFF_HRS FROM MY_TABLE A, MY_TABLE B WHERE A.NAME='AAA' AND B.NAME='BBB' AND A.FOR_DT=B.FOR_DT