Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SELECT - parenthesis ignored by Oracle ???
See post from others.
Also you have to bear in mind that parenthesis will be 'ignored' in
your particular statement since you are using all ANDs. If your
statements had ORs, NOTs etc, the stuff in parenthesis will be worked
out first and the OR or NOT logic applied (hope that makes sense, no
time to explain by example!)
Your statement will be interperated as
select distinct(year || period)
from IC_BIN_MOVEMENTS
WHERE WAREHOUSE='SF'
AND PERIOD <> 10
AND YEAR <> 2001;
To actually get the results your require, try
select distinct(year || period)
from IC_BIN_MOVEMENTS
WHERE WAREHOUSE='SF'
AND year || period <> '200110';
Its not efficient index-wise but does the job.
M
"Syltrem" <syltrem_at_videotron.pas.de.spam.ca> wrote in message news:<d7qS7.14057$a5.560440_at_wagner.videotron.net>...
> I do
> select distinct(year || period)
> from IC_BIN_MOVEMENTS
> WHERE WAREHOUSE='SF'
> AND (PERIOD<>10 AND YEAR<>2001);
>
> That is, I want all rows where warehouse = SF and the date is not october
> 2001.
> What it returns is all rows for warehouse SF where the period is not 10 (of
> any year) and year is not 2001.
> As a result I get all months except october for every year, and nothing at
> all for the whole year 2001.
>
> Why are the parenthesis ignored?
>
> Thanks!
Received on Mon Dec 17 2001 - 05:00:03 CST