Skip to content
Advertisement

Add minutes to an Oracle date

I am trying to add minutes to my sql but no error and no data.

This is my sql

And I want to add 5 minutes to (MO.INSERT_TIME,’DD-MM-YYYY HH24:MI:SS’)

So I want my sql show me after 5 minutes for this column (MO.INSERT_TIME,’DD-MM-YYYY HH24:MI:SS’)

I wrote sql like that

And after 5 minutes I am selecting this sql and their is no data. Can you explain why?

Advertisement

Answer

This is what you used:

It is wrong because you’re applying TO_DATE function to SYSDATE which already returns DATE datatype, so there’s no point in doing it.


It is probably not very likely that MO.INSERT_TIME will exactly be the same as SYSDATE (which is right now) + 5 minutes, which is in the future.

Perhaps you’d rather set that condition to e.g. rows inserted during last 5 minutes (which makes more sense to me):

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement