Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need help understanding trunc(date)

csphardJun 25 2009 — edited Jun 25 2009
Oracle stores date in date time format by using trunc on the date I get rid of the time.

So if I do select sysdate from dual it returns MM/DD/YYYY but this HH:mm:ss is also there I do not see it
but doing select trunc(sysdate) from dual this returns MM/DD/YYYY only. Is that correct.

Because I have a problem when I do a between with our database. Some items are dropping off and I think it is because of the time.
If I trunc the date such as select * from table where trunc(createdate) between to_date('01/01/200p','mm/dd/yyyy') and to_date('01/01/200p','mm/dd/yyyy')
it works without the trunc it returns less.

Is using the trunc the right approach.

Howard
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2009
Added on Jun 25 2009
4 comments
3,026 views