PLSQL

PL/SQL Operator Precedence

PL/SQL Operator Precedence

This term determines the grouping of the terms in an expression. This shows how an expression is evaluated. Certain operators will have higher precedence than others, like Multiplication operator has higher precedence than the addition operator. 

Let us see an example:

Y = 5 + 2 * 3

In the above equation Y is assigned 11, not 21. Since, * has higher precedence than +. So, it first gets multiplied with 2*3 and then adds into 5.

However, operators with the highest precedence appear at the top of the table, those with the lowest precedence appear at the bottom. And then within the expression, higher precedence operators will be evaluated first.

The precedence of the operators goes like as follow: =, <, >, <=, >=, <>, !=, ~=, ^=, IS NULL, LIKE, BETWEEN, IN.

Operator

Operation

**

Exponentiation

+, -

Identity, negation

*, /

Multiplication, division

+, -, ||

Addition, subtraction, concatenation

NOT

Logical negation

AND

conjunction

OR

inclusion