Skip to content
Advertisement

Oracle – Convert datetime format

I have a temp table.

It has last_update column in 2/10/2018 6:01:50 PM datetime format.

How can I write THE BEST QUERY to display all information that’s updated on 02-Oct-2018 day?

Advertisement

Answer

It is preferable to avoid TRUNC especially if you have an index on the column last_update. A simple where condition should be better and may be better performant.

WHERE last_update >= date '2018-10-02' AND
      last_update <  date '2018-10-02' + 1
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement