Header Ads

Header ADS

Number Functions in Oracle SQL

Number Functions in Oracle SQL

Topic Introduction: In this tutorial, Discover how to perform calculations with numeric data in this tutorial on Number functions in a programming language. Learn about various Functions that take in numeric inputs and return calculated results.

  • ROUND: Rounds value to a specified decimal
  • TRUNC: Truncates value to a specified decimal
  • MOD: Returns the remainder of the division
Master the art of rounding and truncating numeric values with the ROUND and TRUNC functions, and calculate remainders with the MOD function in this comprehensive guide on numeric calculations.

ROUND

Purpose: Rounding to a specific decimal place or to the nearest whole number can be achieved through the process of "rounding off". The number of decimal places to round off to (n) can be specified or omitted, with the default being no decimal places. When n is negative, the rounding occurs to the left of the decimal point, affecting the whole number.
Structure: ROUND(column|expression, n)
Example1: Select ROUND(22.26) from dual;
Result: 22.27

TRUNC

Purpose: Truncates the column, expression, or value to n decimal places or, if n is omitted, n defaults to zero
Structure: TRUNC(column|expression, n) 
Example1: Select TRUNC(22.26) from dual;
Result: 22.20

MOD

Purpose: Returns the remainder of m divided by n
Structure: MOD(m,n)
Example1: Select MOD(13,4) from dual;
Result: 1


No comments

Theme images by Deejpilot. Powered by Blogger.