O'Reilly logo

Oracle SQL: the Essential Reference by David C. Kreines

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required