
- PL/SQL - Home
- PL/SQL - Overview
- PL/SQL - Environment
- PL/SQL - Basic Syntax
- PL/SQL - Data Types
- PL/SQL - Variables
- PL/SQL - Constants and Literals
- PL/SQL - Operators
- PL/SQL - Conditions
- PL/SQL - Loops
- PL/SQL - Strings
- PL/SQL - Arrays
- PL/SQL - Procedures
- PL/SQL - Functions
- PL/SQL - Cursors
- PL/SQL - Records
- PL/SQL - Exceptions
- PL/SQL - Triggers
- PL/SQL - Packages
- PL/SQL - Collections
- PL/SQL - Transactions
- PL/SQL - Date & Time
- PL/SQL - DBMS Output
- PL/SQL - Object Oriented
PL/SQL - Arithmetic Operator
Following table shows all the arithmetic operators supported by PL/SQL. Let us assume variable A holds 10 and variable B holds 5, then −
Operator | Description | Example |
---|---|---|
+ | Adds two operands | A + B will give 15 |
- | Subtracts second operand from the first | A - B will give 5 |
* | Multiplies both operands | A * B will give 50 |
/ | Divides numerator by de-numerator | A / B will give 2 |
** | Exponentiation operator, raises one operand to the power of other | A ** B will give 100000 |
Example
BEGIN dbms_output.put_line( 10 + 5); dbms_output.put_line( 10 - 5); dbms_output.put_line( 10 * 5); dbms_output.put_line( 10 / 5); dbms_output.put_line( 10 ** 5); END; /
When the above code is executed at SQL prompt, it produces the following result −
15 5 50 2 100000 PL/SQL procedure successfully completed.
plsql_operators.htm
Advertisements