SQL Language (MOSC)

MOSC Banner

Using DATE comparison in 19c database

Hello All,

We have a question on DATE comparison for our 19c database

We have a table with DATE data type in it

SQL> select max(dt) from app_pst_info;

MAX(DT)

---------

11-JAN-23

Our question is based on the best practices for finding out records with that date in the table

We were able to do that using this query

SQL> select count(*) from app_pst_info

where to_char(dt,'mm-dd-yyyy')= '01-09-2023'  

/

 COUNT(*)

----------

   19564

But is that the correct / recommended way of handling DATE data type in queries

We tried this but it is not returning the correct results

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center