w3resource

Oracle Arithmetic Operators

Introduction

Arithmetic operators can perform arithmetical operations on numeric operands involved. Arithmetic operators are addition(+), subtraction(-), multiplication(*) and division(/).

  • Some of these operators are also used in datetime and interval arithmetic.
  • The arguments to the operator must resolve to numeric data types or to any data type that can be implicitly converted to a numeric data type.
  • Unary arithmetic operators return the same data type as the numeric data type of the argument.
  • For binary arithmetic operators, Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data type, and returns that data type.

Arithmetic Operators

  • + - : These denote a positive or negative expression, they are unary operators.
  • + - : When they add or subtract, they are binary operators.
  • */ : Multiply, divide. These are binary operators.

Note:

Do not use two consecutive minus signs (--) in arithmetic expressions to indicate double negation or the subtraction of a negative value.
The characters -- are used to begin comments within SQL statements. You should separate consecutive minus signs with a space or parentheses.

SQL> SELECT 250 + 365 FROM DUAL;
250+365 
----------
615 
SQL> SELECT 355 - 155 FROM DUAL;
355-155
---------- 
200 
SQL> SELECT 125 * 25 FROM DUAL;
125*25 
---------- 
3125 
SQL> SELECT 625 / 25 FROM DUAL;
625/25
----------
25 
SQL> SELECT 'w3resource' || '.com' FROM DUAL;
'W3RESOURCE'||
--------------
w3resource.com

Previous: Unary and Binary Operators
Next: Hierarchical Query Operators



Follow us on Facebook and Twitter for latest update.