Answer the question
In order to leave comments, you need to log in
Why is this query not working?
select extract( day from diff ) days,
extract( hour from diff ) hours,
extract( minute from diff ) minutes,
extract( second from diff ) seconds
from (select TO_TIMESTAMP('06-APR-82 11.56.11.000000 AM', 'DD.MM.YYYY HH24:MI:SS,FF') - TO_TIMESTAMP('21-DEC-47 11.56.11.000000 AM','DD.MM.YYYY HH24:MI:SS,FF') diff
from dual)
Answer the question
In order to leave comments, you need to log in
I advise you to get acquainted with the arithmetic of dates in oracle. The result of the date1-date2 operation will always be a number (number of days).
It would be better if you wrote the text of the error, and not the text of the request, more useful
Got it! Returns the number of days
select extract( day from diff ) days,
extract( hour from diff ) hours,
extract( minute from diff ) minutes,
extract( second from diff ) seconds
from (select TO_TIMESTAMP('06-APR-2015 11.56.11.000000 AM','DD.MM.YYYY HH.MI.SS.FF AM') - TO_TIMESTAMP('06-APR-2014 11.56.11.000000 AM', 'DD.MM.YYYY HH.MI.SS.FF AM') diff
from dual)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question