PL/SQL Operators

Oracle PL/SQL offers a variety of operators that can be used in various situations. These include:

Arithmetic operators are used to perform mathematical operations such as addition (+), subtraction (-), multiplication (*), division (/), and modulus (MOD).

Logical operators are used to evaluate Boolean expressions and return either TRUE or FALSE. The logical operators in PL/SQL include AND, OR, and NOT.

SET operators combine the results of two or more SELECT statements into a single result. The set operators in PL/SQL include UNION, UNION ALL, INTERSECT, and MINUS.

Comparison operators are used to compare two expressions and return a Boolean value. The comparison operators in PL/SQL include =, <>, >, <, >=, <=, IS NULL, IS NOT NULL, BETWEEN, IN, and LIKE.

It’s important to note that the order of precedence of these operators follows the standard arithmetic order of operations: Parentheses, Exponentiation, Multiplication and Division, Addition and Subtraction, Comparison, Logical Negation, Logical Conjunction, Logical Disjunction.

Operators Arithmetic operators description
+ Addition
* Multiplication
/ Division
|| Concatenation
** Exponentiation
Operators Comparison operators description
= Equal to
!= , <> Not equal to
> Greater Than
>= Greater Than or Equal To
< Less Than
<= Less Than or Equal to
IS NULL Return TRUE if its operand is null or FALSE if it is not null.
LIKE Return TRUE if the patterns match or FALSE if they do not match.
BETWEEN Check whether a value is in a specified range.
IN Compare the value to be equal to any value.
NOT IN Compare the value not to be equal with certain values.
Operators Logical operators description
AND Displays records if all operands are true.
OR Displays records if at least one operand is true.
NOT Displays records if the condition return false.
Operators Other operators description
@ Remote connection
:= Assignment
.. Range
; Statement terminator