Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Urgent! Programming Question ,(value of current date/value of prior date)
"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, USAReceived on Tue Dec 30 2003 - 19:19:51 CST
![]() |
![]() |