0% found this document useful (0 votes)
31 views8 pages

Single Row Functions: 1. Numbers Manipulation

This document discusses several single row functions in Oracle for manipulating numbers: ABS returns the absolute value of a number; CEIL and FLOOR return the smallest or largest integer greater than or less than a number; MOD returns the remainder of a division; POWER returns the first number raised to the power of the second; ROUND rounds a number to a specified precision; and TRUNC truncates a number to a specified precision. Examples are provided for each function.

Uploaded by

gcostea32
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views8 pages

Single Row Functions: 1. Numbers Manipulation

This document discusses several single row functions in Oracle for manipulating numbers: ABS returns the absolute value of a number; CEIL and FLOOR return the smallest or largest integer greater than or less than a number; MOD returns the remainder of a division; POWER returns the first number raised to the power of the second; ROUND rounds a number to a specified precision; and TRUNC truncates a number to a specified precision. Examples are provided for each function.

Uploaded by

gcostea32
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

SINGLE ROW

FUNCTIONS
1. NUMBERS MANIPULATION
Prof. Carmen Popescu
Oracle Academy Lead Adjunct

ABS

ABS(n)

returns the absolute value of n


ABS(10) = 10
ABS(-5.8) = 5.8

CEIL, FLOOR

Ceil(nr)
FLOOR(nr)

CEIL returns the smallest integer that is greater


or equal to nr
FLOOR returns the largest integer that is smaller
or equal to nr

CEIL, FLOOR Example

CEIL(nr)

CEIL(2) = 2
CEIL(1.3) = 2
CEIL(1.8) = 2
CEIL(-2.3) = -2

FLOOR(nr)

FLOOR(2) = 2
FLOOR(1.3) = 1
FLOOR(1.8) = 1
FLOOR(-2.3) = -3

MOD

MOD(n1,n2)

MOD divides n1 by n2 and tells the remainder

MOD(100,10) = 0
MOD(22,23) = 22
MOD(-30.23,7) = -2.23

7*(-4) + (2.23) = - 30.23

MOD(4.1,0.3) = 0.2

0.3* 13 + 0.2 = 4.1

POWER

POWER(n1,n2)

POWER(3,2) = 9
POWER(3,3) = 27
POWER(3,1.086)=3.29726371
POWER(64,0.5) = 8

ROUND

ROUND(value,precision)

ROUND(55.5) = 56
ROUND(33.3) = 33
ROUND(-55.5) = -56
ROUND(-33.3) = -33
ROUND(45.926,2) = 45.93
ROUND(45.923,2) = 45.92
ROUND(45.926,-1) = 50
ROUND(42.926,-1) = 40
ROUND(45.926,-2) = 0
ROUND(65.926,-2) = 100

TRUNC

TRUNC(value,precision)

TRUNC(55.5) = 55
TRUNC(33.3) = 33
TRUNC(-55.5) = -55
TRUNC(-33.3) = -33
TRUNC(45.926,2) = 45.92
TRUNC(45.923,2) = 45.92
TRUNC(45.926,-1) = 50
TRUNC(42.926,-1) = 40
TRUNC(45.926,-2) = 0
TRUNC(65.926,-2) = 0

You might also like