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: Urgent! Programming Question ,(value of current date/value of prior date)

Re: Urgent! Programming Question ,(value of current date/value of prior date)

From: Matthias Wirtz <Matthias.Wirtz_at_epost.de>
Date: Tue, 30 Dec 2003 20:19:51 -0500
Message-ID: <bst87g$1a47h$1@ID-151394.news.uni-berlin.de>


"Alex Filonov" afilonov_at_yahoo.com wrote in message news:336da121.0312300749.16ae742_at_posting.google.com...

> > I think there is a comma and parathesis missing. I tried it with:
> >
> > select to_char(a1.sdate,'YYYY-MM-DD'), a1.svalue/a2.svalue indicator1
> > from account a1, account a2
> > where a1.sdate between &begin_date and &end_date
> > and trunc(a2.sdate)(+) = trunc(add_months(trunc(a1.sdate),-1));
> >
> > But I got an error:
> >
> > where trunc(a2.sdate) (+) = trunc(add_months(trunc(a1.sdate),-1))
> > *
> > ERROR in row 3:
> > ORA-00936: missing expression
> >
> > I don't know what oracle is complaining about.
>
> Proper syntax would be:
>
> where trunc(a2.sdate (+) ) = trunc(add_months(trunc(a1.sdate),-1))
>
> (+) has to follow the column of outer joined table, not the expression.

Yes, exactly. With this syntax it is working fine.

But I would use the LAG function in order to cut the consistent gets by half and only have one full table scan.

--
Matthias Wirtz  -  Norfolk, USA
Received on Tue Dec 30 2003 - 19:19:51 CST

Original text of this message

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