Search This Blog

Showing posts with label Number Functions. Show all posts
Showing posts with label Number Functions. Show all posts

Thursday, August 30, 2012

Number Functions Example

Number Functions Example


1. ROUND

The Round function rounds the value to the n decimal values. If n is not specified, there won't be any decimal places. If n is negative, numbers to the left of the decimal point are rounded.

Syntax: round(number,n)

SELECT round(123.67,1) FROM DUAL;

SELECT round(123.67) FROM DUAL;

SELECT round(123.67,-1) FROM DUAL;


2. TRUNC

The Trunc function truncates the value to the n decimal places. If n is omitted, then n defaults to zero.

Syntax: trunc(number,n)

SELECT trunc(123.67,1) FROM DUAL;

SELECT trunc(123.67) FROM DUAL;


3. MOD

The Mod function returns the remainder of m divided by n.

Syntax: mod(m,n)

SELECT mod(10,5) FROM DUAL;