Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Select query using to_date

Re: Select query using to_date

From: Dave <recneps.w.divad_at_elcaro.moc>
Date: Thu, 12 Aug 2004 16:23:14 +0100
Message-ID: <I7MSc.39$S26.118@news.oracle.com>


First things I'd look at are:
- '01/10' || 2004, if it works, will give you '01/102004' rather than '01/10/2004'
- 'YYYY'-1, you probably meant to have the -1 after the )

Dave.

George wrote:

> Hi,
>
> I'm trying to run a select query with a date parameter. The
> 'Tran_date' needs to be between two dates and I have a 'case'
> condition that determines these dates:
>
> and a.tran_date between
> Case when (extract(month from sysdate)) > 10
> then to_date('01/10' || to_number(sysdate, 'YYYY'), 'DD/MM/YYYY')
> else to_date('01/10' || to_number(sysdate, 'YYYY'-1), 'DD/MM/YYYY')
> End
> and sysdate
>
> If the sysdate month is greater that 10 then the date is '01/10' and
> the Year needs to be the current year. Else the date is '01/10' and
> the year is the previous year. I keep getting an 'Invalid number'
> error.
>
> Can anyone help with this?
>
> Thanks in advance
> George
Received on Thu Aug 12 2004 - 10:23:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US