Skip to main content
Home
  • Tutorials
    • Quality Assurance
    • Software Development
    • Machine Learning
    • Data Science
  • About Us
  • Contact
programsbuzz facebook programsbuzz twitter programsbuzz linkedin
  • Log in

Main navigation

  • Tutorials
    • Quality Assurance
    • Software Development
    • Machine Learning
    • Data Science
  • About Us
  • Contact

Oracle Arithmetic Operators

Profile picture for user akshita.goel
Written by akshita.goel on 10/07/2021 - 07:13

In Mathematics, basic operators (+, -, /, *) helps to add, subtract, divide or multiply two numbers. In oracle, they are arithmetic operators that perform an arithmetic operation between 2 numbers.

List of Arithmetic Operators

  1. + Operator: Used to add 2 numbers
  2. - Operator: Used to subtract numbers
  3. * Operator: Used to multiply numbers.
  4. / Operator: Used to divide numbers.
  5. MOD Operator: It is a special kind of Operator. For further reference, click here.

1. Arithmetic Operations on Numeric Values

Syntax

If it is between 2 numbers:

n1 Operator n2

where n1 and n2 are different numbers. 

Suppose we add a column Marks in a Stu table. we have the table stu shown below:

Stu
Name Section Roll_No Subject Marks_Outof_100
Radha B 180 Science 56
Shruti B 16 Science 40
Sneha B 17 Science 20
Akshita C 1 Commerce 80
Bhoomika C 16 Humanities 78

To insert Values into the Table, click here. 

Example 1:  Now, we want to know marks of Students by adding 10 Marks more to the existing marks:

SELECT Name, Marks+10 FROM Stu;

Example 2: Same as above, we can use other mentioned operators ie. -,*,/ & %:

SELECT Name, Marks-10, Marks/10,Marks*10 FROM Stu;

Output:

Operators

Example 3: We want to first multiply the marks by 100 and divide the result by 10.

SELECT Name, (Marks*100)/10 FROM Stu;

Output

op

2. Arithmetic Operations on Date Values

We can only perform + & - Operator when it comes to Date. No * and / take place while working with Dates.

For example, we created another Variable ADD_Date that represents the Admission Date of a student in the Stu table.

Refer to the table given below:-

Date

Example 1: we want to perform + & - Operator with Add_Date:

SELECT ADD_Date+5 from Stu;

Output:

Date + operator

Example 2:

SELECT ADD_Date-5 from Stu;

Date - operator

NOTE:

  1. We cannot perform arithmetic operations with strings.
  2. Any calculation performed on NULL values will return NULL.
Related Content
Oracle Tutorial
Oracle: MOD() Function
Count in Oracle SQL
  • Log in or register to post comments

Choose Your Technology

  1. Agile
  2. Apache Groovy
  3. Apache Hadoop
  4. Apache HBase
  5. Apache Spark
  6. Appium
  7. AutoIt
  8. AWS
  9. Behat
  10. Cucumber Java
  11. Cypress
  12. DBMS
  13. Drupal
  14. GitHub
  15. GitLab
  16. GoLang
  17. Gradle
  18. HTML
  19. ISTQB Foundation
  20. Java
  21. JavaScript
  22. JMeter
  23. JUnit
  24. Karate
  25. Kotlin
  26. LoadRunner
  27. matplotlib
  28. MongoDB
  29. MS SQL Server
  30. MySQL
  31. Nightwatch JS
  32. PactumJS
  33. PHP
  34. Playwright
  35. Playwright Java
  36. Playwright Python
  37. Postman
  38. Project Management
  39. Protractor
  40. PyDev
  41. Python
  42. Python NumPy
  43. Python Pandas
  44. Python Seaborn
  45. R Language
  46. REST Assured
  47. Ruby
  48. Selenide
© Copyright By iVagus Services Pvt. Ltd. 2023. All Rights Reserved.

Footer

  • Cookie Policy
  • Privacy Policy
  • Terms of Use