Skip Headers

Oracle9i SQL Reference
Release 2 (9.2)

Part Number A96540-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page Go to next page
View PDF

Arithmetic Operators

You can use an arithmetic operator in an expression to negate, add, subtract, multiply, and divide numeric values. The result of the operation is also a numeric value. Some of these operators are also used in date arithmetic. Table 3-2 lists arithmetic operators.

Table 3-2 Arithmetic Operators
Operator Purpose Example

+ -

When these denote a positive or negative expression, they are unary operators.

SELECT * FROM order_items
 WHERE quantity = -1;
SELECT * FROM employees
  WHERE -salary < 0;

When they add or subtract, they are binary operators.

SELECT hire_date 
  FROM employees
  WHERE SYSDATE - hire_date
  > 365;

* /

Multiply, divide. These are binary operators.

UPDATE employees
  SET salary = salary * 1.1;

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 a parenthesis.

See Also:

"Comments" for more information on comments within SQL statements