Question about filter with dates

Asked

Viewed 25 times

0

I’m a beginner in SQL, and I’m working on a project on Oracle. I got stuck in a situation that theoretically would be simple to solve, but I don’t succeed. They can help me?

Below follows the code I’m trying to apply, everything is working except the date filter. What am I doing wrong? And what is the suggested correction? I need dates greater than 21/01/2020.

Select BIIN.HISTORICO_STATUS_OBJETO.HISO_CD_OBJETO,
         BIIN.HISTORICO_STATUS_OBJETO.HISO_CD_TIPO_OBJETO_TEXT_LONGO,
         BIIN.HISTORICO_STATUS_OBJETO.HISO_DT_MODIFICACAO_STATUS
  from BIIN.HISTORICO_STATUS_OBJETO
  where BIIN.HISTORICO_STATUS_OBJETO.HISO_CD_OBJETO = 'OR002022477553'
  and BIIN.HISTORICO_STATUS_OBJETO.HISO_DT_MODIFICACAO_STATUS > '21-01-2020'
  order by BIIN.HISTORICO_STATUS_OBJETO.HISO_DT_MODIFICACAO_STATUS asc

Upshot:

inserir a descrição da imagem aqui

  • 1

    Try the date like this: '2020-01-21'. See the need to make a cast.

  • 1

    Force the format to_date('21/01 /2020','DD/MM/YYYY') for more details https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_commands_1029.htm#OLADM780

No answers

Browser other questions tagged

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