0% found this document useful (0 votes)
72 views

SQL-3 Single Row Functions

This document summarizes single row functions in Oracle including character functions like UPPER, LOWER, INITCAP; number functions like ROUND, TRUNC, MOD; date functions like ADD_MONTHS, LAST_DAY, MONTHS_BETWEEN; conversion functions like TO_CHAR, TO_DATE; and the NVL function for converting null values. Examples are provided for each function.
Copyright
© © All Rights Reserved
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)
72 views

SQL-3 Single Row Functions

This document summarizes single row functions in Oracle including character functions like UPPER, LOWER, INITCAP; number functions like ROUND, TRUNC, MOD; date functions like ADD_MONTHS, LAST_DAY, MONTHS_BETWEEN; conversion functions like TO_CHAR, TO_DATE; and the NVL function for converting null values. Examples are provided for each function.
Copyright
© © All Rights Reserved
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
You are on page 1/ 9

Single Row Functions

Character functions

UPPER(char)

LOWER(char)

INITCAP(char)

INSTR(char1,char2[,n[,m]])

LPAD(char1,n [,char2])

SUBSTR(char,n)

TRIM(char FROM char1)

LENGTH (char);
Character Functions

Function Result

UPPER(’cate’) CATE

LOWER(’CAte’) cate

INITCAP(’my name’) My Name

SUBSTR(‘String',1,3) Str

LENGTH('String') 6

INSTR('String', 'r') 3

LPAD(sal,10,'*') ******5000

TRIM('S' FROM 'SSMITH') MITH


Number Functions
ROUND(n[,m])

MOD(m,n)

TRUNC(n[,m])

SIGN(n)

etc.,

Function Result

ROUND(45.926,2) 45.93

TRUNC(45.926,2) 45.92

MOD(1600,300) 100
Number functions

Group value functions


 SUM([DISTINCT|ALL] n)
 AVG([DISTINCT|ALL] n)
 COUNT({* | [DISTINCT|ALL] expr})

List value functions


 GREATEST(expr [,expr] ...)
 LEAST(expr [,expr] ...)
Date Functions

ADD_MONTHS(d,n)

LAST_DAY(d)

MONTHS_BETWEEN(d1,d2)

SYSDATE
Conversion functions

TO_CHAR(d [, fmt [, 'nlsparams'] ])

TO_CHAR(n [, fmt [, 'nlsparams'] ])

TO_DATE(char [, fmt [, 'nlsparams'] ])


NVL Function

Converts null to an actual value


 Datatypes that can be used are date, character, and number.
 Datatypes must match
NVL(comm,0)
NVL(hiredate,'01-JAN-97')
NVL(job,'No Job Yet')

You might also like