Web Development
 
Your Ad Here
Select between two dates 
A few hints when dealing with "between date" searches, these are corrections to oracle manuals that don't tell you to handle this properly:

SELECT *
FROM
Your Table
WHERE
DTM_COLUMN BETWEEN TO_DATE('03-01-2006', 'MM-DD-YYYY') AND TO_DATE('03-17-2006', 'MM-DD-YYYY')+1

By using the +1 you get the data between 3/01 to 3/17

Without the +1 you get the data between 3/01 to 3/16

----

Another hint, if you have any queries like the following, you best fix them before the year rolls over...

SELECT *
FROM
WHERE
TO_CHAR(DTM_COLUMN, 'MM-DD-YYYY') BETWEEN '03-01-2007' AND '03-17-2007'

The above example works fine until you change the start year to 2006...
Oracle can not search TO_CHAR unless it is within the same year...


[ add comment ] ( 5 views )   |  permalink  |   ( 2.9 / 219 )

<<First <Back | 1 | 2 | 3 | 4 | Next> Last>>


Home | Portfolio | Hosting | Web Development | Contact Us
© 2007 dpwebservices.net. All right reserved.