The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
how to use to_date in read database for oracle query
sgnarkhede2016
Member Posts: 152 Contributor II
in Help
Hello I want to check condition like this
previously i checked this way
trunc(Date) = trunc(SYSDATE)-1
but now my date fromat is change it comes like this 20211201,how can i change in the query using to_date function
previously i checked this way
trunc(Date) = trunc(SYSDATE)-1
but now my date fromat is change it comes like this 20211201,how can i change in the query using to_date function
0
Answers
you aren't providing the necessary details, and my experience with databases is fortunately not with Oracle.
If your Date column has the right type, the database should correctly compare it to the output of trunc(SYSDATE) (which should be unnecessary if the SYSDATE is already a date, not a timestamp). If the Date column is not a date or timestamp, but a VARCHAR, you need to cast it to a date using the appropriate Oracle function for this.
Which error message are you getting? Or where do you get the wrong data?
Regards,
Balázs