Arithmatic Operators in Oracle
Arithmetic operators in oracle can be used to add, subtract, multiply, divide and negate numeric values. The + and - arithmetic operators can also be used in datetime and interval arithmetics.
Based on the function we can divide the arithmetic operators in the following types.
1)Unary + and - Operator:
-----------------------------------------------
•When + or - denote positive or negative expression then they are called unary operators.
•To represent positive or negative expression the + an - operator appear just before operand.
•Example of unary operator:
Select col1 from table1 where col1>-1;
Select col1 from table1 where -col1>1;
Here - operator used as unary operator.
2)Binary + and - Operator:
---------------------------------------------
•When + and - are used to add or subtract operands then they are called binary operators.
•They appear between operands.
•Example of binary operator:
Select col1 from table1 where col1+col2>10;
3)Binary * and / Operator:
------------------------------------------------
•The * operator is used to multiply operands and / is used for divide.
•Both are binary operators.
Based on the function we can divide the arithmetic operators in the following types.
1)Unary + and - Operator:
-----------------------------------------------
•When + or - denote positive or negative expression then they are called unary operators.
•To represent positive or negative expression the + an - operator appear just before operand.
•Example of unary operator:
Select col1 from table1 where col1>-1;
Select col1 from table1 where -col1>1;
Here - operator used as unary operator.
2)Binary + and - Operator:
---------------------------------------------
•When + and - are used to add or subtract operands then they are called binary operators.
•They appear between operands.
•Example of binary operator:
Select col1 from table1 where col1+col2>10;
3)Binary * and / Operator:
------------------------------------------------
•The * operator is used to multiply operands and / is used for divide.
•Both are binary operators.
Comments
Post a Comment