PL/SQL: Operators Cheat Sheet

Arithmetic Operators
OperatorDescription
+Adds two operands
Subtracts second operand from the first
*Multiplies both operands
/Divides numerator by de-numerator
**Exponentiation operator, raises one operand to the power of other
Relational Operators
OperatorDescription
=Checks if the values of two operands are equal or not, if yes then condition becomes true.
!=<>~=Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.
>Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.
<Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.
>=Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.
<=Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.
Comparison Operators
OperatorDescription
LIKEThe LIKE operator compares a character, string, or CLOB value to a pattern and returns TRUE if the value matches the pattern and FALSE if it does not.
BETWEENThe BETWEEN operator tests whether a value lies in a specified range. x BETWEEN a AND b means that x >= a and x <= b.
INThe IN operator tests set membership. x IN (set) means that x is equal to any member of set.
IS NULLThe IS NULL operator returns the BOOLEAN value TRUE if its operand is NULL or FALSE if it is not NULL. Comparisons involving NULL values always yield NULL.
Logical Operators
OperatorDescription
andCalled the logical AND operator. If both the operands are true then condition becomes true.
orCalled the logical OR Operator. If any of the two operands is true then condition becomes true.
notCalled the logical NOT Operator. Used to reverse the logical state of its operand. If a condition is true then Logical NOT operator will make it false.

Leave a Reply

Your email address will not be published. Required fields are marked *