1 / 8

SINGLE ROW FUNCTIONS

This resource, led by Prof. Carmen Popescu from Oracle Academy, provides a concise overview of essential numeric functions used in Oracle SQL for data manipulation. Key functions include ABS for absolute values, CEIL and FLOOR for rounding, MOD for finding remainders, POWER for exponentiation, and ROUND and TRUNC for numerical adjustments. Each function is illustrated with practical examples to ensure clear understanding and effective application. This guide is ideal for SQL learners seeking to enhance their numeric computation skills.

Télécharger la présentation

SINGLE ROW FUNCTIONS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. ABS • ABS(n) • returns the absolute value of n • ABS(10) = 10 • ABS(-5.8) = 5.8

  3. 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

  4. 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

  5. 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

  6. POWER • POWER(n1,n2) • POWER(3,2) = 9 • POWER(3,3) = 27 • POWER(3,1.086)=3.29726371 • POWER(64,0.5) = 8

  7. 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

  8. 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

More Related