Need help understanding trunc(date)
csphardJun 25 2009 — edited Jun 25 2009Oracle 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