PL/SQL - SPLessons

PL/SQL Operator

Chapter 11

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

PL/SQL Operator

PL/SQL Operator

shape Description

PLSQL Operator is a symbol that instructs the compiler to execute some particular logical manipulation and mathematical operation. PL/SQL has some particular operators by default, such as

Arithmetic operator

shape Description

Arithmetic PLSQL Operator executes one or more numeric values and returns the output of a numeric value. The following are the arithmetic operators.

Operator Description Example
+ Performs addition of two numbers A+B,Example 10+5=15
Performs subtraction of two numbers A-B,Example 10-5=5
* Performs multiplication of two numbers A*B,Example 10*5=50
/ Performs division of two numbers A/B,Example 10/5=2

Comparison operator

shape Description

Comparison operators compares one expression with another, thereby giving a consistent result as NULL, TRUE OR FALSE.

Operator Description
BETWEEN Check whether the given value is in the range between min and max.
IN The IN operator tests a collection of membership.
LIKE Compares a string, character or CLOB values.
IS NULL IS NULL operator gives back the boolean result i.e, if the value is NULL, it returns TRUE or if the value is not NULL, it returns FALSE.

Relational operator

shape Description

Relational PLSQL Operator analyse two explanations and gives back the outcome in the form of boolean operation.

Operator Description Example
= Analyse whether the two values are True or False, if true, then the case will be true. A=B
< Analyse whether the left value is less than the right value, if true, then the case becomes true. A<B
> Analyse whether the left value is greater than the right value, if true, then the case will be true. A>B
<= Analyse whether the left value is less than or equal to the right value, if yes, then the case becomes true. A<=B
>= Analyse whether the left value is greater than or equal to the right value, if true, then the case becomes true. A>=B

Logical operator

shape Description

Logical operator operates on two operands and returns a boolean value as the output. The accessible logical operators are AND, OR and NOT.

Operator Description
AND It is called as logical AND operator. If two values are true, then the case becomes true.
OR It is called as logical OR operator, suppose any one value is true, then the case become true.
NOT It is called as logical NOT operator, if a case is true, then the logical NOT operator will make it false.

String operator

shape Description

A string is defined as the succession of characters with a discretionary size specifications. The characters can be special characters, letters, numeric, and accumulation of whole sequence or blanks. There are three sorts of strings, for example, 

Character large objects

These objects are variable-length strings that range to 128.

Fixed-length strings

While declaring a string, the developer will determine the length. The string is protected with spaces to the length as indicated.

Variable-length strings

The greatest length of variable-length string reaches to 32,767.

Summary

shape Key Points

  • PLSQL Operator – It is a symbol that instructs the compiler to execute some particular operations.
  • Arithmetic operator – Executes one or more numeric values and returns the result set.
  • Comparison operator – Compares one expression with another.
  • Relational operator – Relational operators compare two expressions and returns the result set.
  • Logical operator – Operates on two operands and returns a boolean output.
  • String operator – A sequence of characters with an discretionary size specifications.