Oracle - Filter by date

Asked

Viewed 9,809 times

5

I have a column dt_atualiza_log who’s with the guy DATE in the table (is saved in format 01/12/2011 10:10:48)

I’m having trouble filtering through and of my query. I’ve tried several ways, the last one:

AND ma.dt_atualiza_log >= to_date('01/01/2018 00:00:00','DD/MM/YYYY hh24:mi')

Error: ORA-01830: date format image ends before convert the entire input string

Looks like I’m making a mistake on time. Can you help, please?

  • It worked... But the data in the table has time, example: 08/01/2018 21:40:13. This is not relevant?

  • 1

    will be if the comparison is less, '01/01/2000 08:00:00' <= '01/01/2000' this comparison returns false, in such cases, either you take the time from the column, or add a day in the parameter: < '02/01/2000' will return everything until 01/01/2000 23:59:59

1 answer

6


Error says that the given format (DD/MM/YYYY) ends before converting the input string, because in the format it has no time and in the given parameter it has.

So just take the time (00:00:00):

AND ma.dt_atualiza_log >= to_date('01/01/2018','DD/MM/YYYY')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.