Oracle PL/SQL Tutorial/Introduction/Arithmetic operator — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 10:05, 26 мая 2010
The normal rules of arithmetic operator precedence apply in SQL
The normal rules of arithmetic operator precedence apply in SQL:
multiplication and division are performed first.
followed by addition and subtraction.
If operators of the same precedence are used, they are performed from left to right.
SQL> SELECT 10 * 12 / 3 - 1 FROM dual;
10*12/3-1
----------
39
SQL>
Use parentheses () to specify the order of execution for the operators
SQL>
SQL> SELECT 10 * (12 / 3 - 1) FROM dual;
10*(12/3-1)
-----------
30
SQL>