首页 > 代码库 > ORACLE中AND与OR的优先级

ORACLE中AND与OR的优先级

 

突然发现,把基础给忘了,AND的优先级大于OR,试验如下:

 

--Y
select ‘Y‘ from dual where 1=2 and 1=2 or 1=1;

--Y
select ‘Y‘ from dual where (1=2 and 1=2) or 1=1;

--No value
select ‘Y‘ from dual where 1=2 and (1=2 or 1=1);

 

一般来说,与>或>非。

附,Oracle文档:

http://docs.oracle.com/cd/E17952_01/refman-5.1-en/operator-precedence.html

 

ORACLE中AND与OR的优先级