1.6. Relational Operators

An operator manipulates data elements and returns a result. The data elements that are operated upon are called operands or arguments, and a special character or keyword represents the actual operator. Oracle SQL supports several types of operators, listed in this section.

1.6.1. Arithmetic Operators

Arithmetic operators perform arithmetical calculations on a pair of data elements and/or constants. Table 1-1 lists the arithmetic operators available in SQL.

Table 1-1. SQL's Arithmetic Operators
Operator Description Example
+ Addition sal + comm
- Subtraction sal - comm
* Multiplication sal * 1.1
/ Division sal / 12
- Negation -sal
+ Identity +sal

1.6.2. Concatenation Operator

The concatenation operator (||) combines two character strings. Consider the following SQL statement:

SELECT fname || ' ' || lname
FROM employee_master;

This statement returns (for each row) a single string consisting of the first name, a space, and the last name.

Although most Oracle platforms use solid vertical bars (||) as the concatenation operator, some platforms, most notably IBM platforms using the EBCDIC character set, use the broken vertical bars (). When converting between ...

Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.