May 2008 - Posts

I was trying to get a set of records in oracle with a certain date interval. I wanted to make sure that I only get the month, day and year part. Good  thing I had an oracle guru officatemate and told me that the TRUNC function strips out the hour, minute, second, etc. portion for me. Since I wasn't very comfortable using the BETWEEN clause in oracle, I went to a more conservative way of getting date intervals...

SELECT * FROM SOME_TBL WHERE TRUNC(date_field) >= TRUNC(ARG_START_DATE) AND TRUNC(date_field) <= TRUNC(ARG_END_DATE); 

I was doing it like TRUNC(date_field, 'MM/DD/YYYY')  but Iwas getting errors like, Too Many Precision Specifiers and sometimes Oracle Fetch out of Sequence.

Posted by lamia | 2 comment(s)
Filed under: