Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Between dates query
Mike Fellows wrote:
> Hi there I have bben trying to create an SQL script used within a form
> to search for a value between two datesalong the lines of .... SELECT
> MONTH FROM TIME TWHERE :BLOCK1.VAL BETWEEN T.DATE_1 AND T.DATE_2 This
> works fine, but when I try to carry out a TO_DATE function to ensure
> Y2K compliancy, I get an error.The script is as follows SELECT MONTH
> FROM TIME TWHERE :BLOCK1.VAL BETWEENTO_DATE('T.DATE_1','DD-MON-RR')
> AND TO_DATE('T.DATE_2','DD_MON_RR) Any ideas are greatly
> appreciated..TIA Mike
You can't convert the string 'T.DATE_1' to a date because it isn't even close to looking like a date. Using your date mask the string would have to be something like '01-JAN-99'.
If what you are really trying to do is reference columns in the TIME table then I would guess it is already in date format and therefore a to_date() would not be valid - although to_char() would be. Received on Wed Sep 08 1999 - 13:32:51 CDT