Oracle8i SQL Reference
Release 2 (8.1.6)

A76989-01

Library

Product

Contents

Index

Prev Up Next

Operators, 4 of 10


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 

+ - 

Denotes a positive or negative expression. These are unary operators. 

SELECT * FROM orders
 WHERE qtysold = -1;
SELECT * FROM emp
  WHERE -sal < 0;
 

* / 

Multiplies, divides. These are binary operators. 

UPDATE emp
  SET sal = sal * 1.1;
 

+ - 

Adds, subtracts. These are binary operators. 

SELECT sal + comm FROM emp
  WHERE SYSDATE - hiredate
  > 365;
 

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. 


Prev Up Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index