Vous êtes sur la page 1sur 188

DB2 SQL QUERY

By Hari Christian
Agenda
Introduction to Database and SQL

Basic SQL

Advance SQL
What Is Database
A database is an organized way of holding
together various pieces of information. The
term database actually refers to the
collection of data, not the means by which
it is stored.

For a computer database, the software
used to manage the data is known as a
database-management system (DBMS).

What Is Database
A filing cabinet and a telephone directory
both contain databases: They hold
information, organized in a structured
manner so that you can easily access the
individual item you want to find.

What Is Database
A database consists of a series of tables.
Each table has a name, which is how it is
referenced in the SQL language. Each
database also has a name, and the same
RDBMS can manage many different
databases.
DB2 is a multiuser database and can
restrict access to each database to only
specific users.

What Is Database
A database table looks somewhat like a
spreadsheet: a set of rows and columns
that can contain data at each intersection.
In a relational database, you store different
types of data in different tables.
For instance, the sample database in this
book has separate tables for customers,
products, and orders.

What Is Database
Each table has a defined set of columns,
which determine the values it can store.
For example, the table that contains
information about products needs to store
a name, price, and weight for every
product.
Each row of data can contain values for
only the columns defined in the table.
What Is Database
In addition, each column is defined as a
particular data type, which determines the
kind of values it can store.

The data type might restrict values to
numeric or date values, or it might impose
a maximum size.
What Is SQL
The Structured Query Language (SQL) is
the most common way to retrieve and
manage database information.
An SQL query consists of a series of
keywords that define the data set you want
to fetch from the database.
SQL uses descriptive English keywords,
so most queries are easy to understand.

Retrieve Data
The first SQL command you will learn, and
the one you will use most frequently, is
SELECT. In this lesson, you begin by
learning how to fetch data records from a
single table.
Retrieve Data
A SELECT statement begins with the
SELECT keyword and is used to retrieve
information from database tables.

You must specify the table name to fetch
data from, using the FROM keyword and
one or more columns that you want to
retrieve from that table.
Retrieve Data
Query Format
SELECT [COLUMN_NAME]
FROM [TABLE_NAME];

Retrieve Single Column
Display column NMDOSEN name from
table QRYLIB.AGSDOS

SELECT NMDOSEN
FROM QRYLIB.AGSDOS;


Retrieve Multiple Column
Display column KDDOSEN and
NMDOSEN name from table
QRYLIB.AGSDOS

SELECT KDDOSEN, NMDOSEN
FROM QRYLIB.AGSDOS;


Retrieve All Column
Display all column from table
QRYLIB.AGSDOS

SELECT *
FROM QRYLIB.AGSDOS;


Retrieve Common Mistake
File or table not found

SELECT *
FROM QRYLIB.AGSDOSS;


Retrieve Common Mistake
Column not in specified table

SELECT NAME
FROM QRYLIB.AGSDOS;


Retrieve Exercise
Retrieve Student Name from
QRYLIB.AGSMHS

Retrieve Student ID and Student Name
from QRYLIB.AGSMHS

Retrieve All column from
QRYLIB.AGSMHS


Retrieve Exercise
Retrieve from QRYLIB.AGSMTKUL

Retrieve from QRYLIB.AGSNIL


Filtering Data
You can add a WHERE clause to a
SELECT statement to tell DB2 to filter the
query results based on a given rule.

Rules in a WHERE clause refer to data
values returned by the query, and only
rows in which the values meet the criteria
in the rule are returned.
Filtering Data
Query Format
SELECT [COLUMN_NAME]
FROM [TABLE_NAME]
WHERE [COLUMN_NAME] [OPERATOR]
[FILTER_CRITERIA];


Filtering Exact Value
Display all information from lecturer D01

SELECT *
FROM QRYLIB.AGSDOS
WHERE KDDOSEN = D01;
Filtering Except Value
Display all lecturer information except
lecturer D01

SELECT *
FROM QRYLIB.AGSDOS
WHERE KDDOSEN != D01;
Filtering Range Value
Display student test with score equal 70

SELECT *
FROM QRYLIB.AGSNIL
WHERE NILAI = 70;
Filtering Range Value
Display student test with score greater
than 70

SELECT *
FROM QRYLIB.AGSNIL
WHERE NILAI > 70;
Filtering Range Value
Display student test with score greater
than or equal 70

SELECT *
FROM QRYLIB.AGSNIL
WHERE NILAI >= 70;
Filtering Range Value
Display student test with score less than
70

SELECT *
FROM QRYLIB.AGSNIL
WHERE NILAI < 70;
Filtering Range Value
Display student test with score less than or
equal 70

SELECT *
FROM QRYLIB.AGSNIL
WHERE NILAI <= 70;
Filtering Common Mistake
Missing quotes (filtering character requires
quotes)

SELECT *
FROM QRYLIB.AGSDOS
WHERE KDDOSEN = D01;
Filtering Exercise
Display all lecturer data with name start
with B
Display all lecturer data with name start
with E
Display lecturer D03 information
Display student data score more than 50
Display student data score more than or
equal 60
Ordering Data
So far, you have seen that data is fetched
from the database in no particular order.

To specify the sorting on the result of a
query, you can add an ORDER BY clause.
Ordering Data
Query Format
SELECT [COLUMN_NAME]
FROM [TABLE_NAME]
ORDER BY [COLUMN_NAME];

Ordering Single Column
Display all student information sort by
code

SELECT *
FROM QRYLIB.AGSMHS
ORDER BY KDMHS;

Ordering Multiple Column
Display all student information sort by
code and name

SELECT *
FROM QRYLIB.AGSMHS
ORDER BY KDMHS, NMMHS;

Ordering Ascending
Display all student information sort by
code (A-Z)

SELECT *
FROM QRYLIB.AGSMHS
ORDER BY KDMHS ASC;

Ordering Descending
Display all student information sort by
code (Z-A)

SELECT *
FROM QRYLIB.AGSMHS
ORDER BY KDMHS DESC;

Ordering Exercise
Display all student score with lowest score
to highest score (0 - 100)
Display all student score with highest
score to lowest score (100 - 0)
Display all student score with highest
score to lowest score (100 - 0) and sort by
student name (Z-A)

Advance Filtering
The examples you have seen so far
perform filtering on a query based on only
a single condition.
To provide greater control over a result
set, MySQL enables you to combine a
number of conditions in a WHERE clause.
They are joined using the logical operator
keywords AND and OR.

Advance Filtering - AND
Display student data with score greater
than or equal 70 and course id is M01

SELECT *
FROM QRYLIB.AGSNIL
WHERE NILAI >= 70 AND KDMTK =
M01;

Advance Filtering - OR
Display student data with score greater
than or equal 70 or course id is M01

SELECT *
FROM QRYLIB.AGSNIL
WHERE NILAI >= 70 OR KDMTK = M01;

Advance Filtering - IN
Display lecture data D03 and D01

SELECT *
FROM QRYLIB.AGSDOS
WHERE KDDOSEN IN ('D03', 'D01');

WHERE KDDOSEN = 'D03 AND
KDDOSEN = 'D01';

Advance Filtering NOT IN
Display lecture data except D03 and D01

SELECT *
FROM QRYLIB.AGSDOS
WHERE KDDOSEN NOT IN ('D03', 'D01');
Advance Filtering BETWEEN
Display employees who were born
between 1920 - 1940

SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE BIRTHDATE BETWEEN '1920-
01-01' AND '1940-01-01';
Advance Filtering Case
Display employee bonus remark
SELECT EMPNO, FIRSTNME, BONUS,
CASE
WHEN BONUS > 800 THEN 'BESAR'
WHEN BONUS > 400 THEN 'SEDANG'
ELSE 'KECIL'
END AS RANKING
FROM OL37V3COL.EMPLOYEE;
Precedence
Display all manager with first name is
Michael or John (see if the result are
correct?)
SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE JOB = 'MANAGER' AND
FIRSTNME = 'Michael' OR FIRSTNME =
'John'
ORDER BY FIRSTNME;
Precedence
Display all manager with first name is
Michael or John (see if the result are
correct?)
SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE JOB = 'MANAGER' AND
(FIRSTNME = 'Michael' OR FIRSTNME =
'John)
ORDER BY FIRSTNME;
Advance Filtering Exercise
Display all manager with bonus more than
$500
Display all employee with bonus more
than or equal $500
Display all employee with salary more than
$20.000 and bonus more than $400 and
commision more than $100
Display student grade
Limiting Data
If you are expecting a query to still return
more rows that you want, even with the
filtering from a WHERE clause applied,
you can add a LIMIT clause to specify the
maximum number of records to be
returned.
Limiting Data
Query Format
SELECT [COLUMN_NAME]
FROM [TABLE_NAME]
FETCH FIRST [NUMBER] ROWS ONLY;


Limiting Data
Retrieve the first 5 data

SELECT *
FROM OL37V3COL.EMPLOYEE
FETCH FIRST 5 ROWS ONLY;


Limiting Data Exercise
Retrieve the first 25 employee data

Retrieve the first 10 student data

Retrieve the first 20 lecturer data

Numeric Function
An expression that uses a numeric
operator can be used in a SQL statement
anywhere that you could otherwise put a
numeric value.

You can also use a numeric operator to
modify retrieved data from a table, as long
as it is numeric data.
Numeric Function
You can actually perform a query in SQL
without supplying a table name.

This is useful only when you have an
expression as a selected value, but it can
be used to show the result of an
expression on fixed values.
Numeric Function
Addition in SQL is performed using the +
operator, and subtraction using the -
operator. The following query shows an
expression using each of these operators:

SELECT 15 + 28, 94 55
FROM SYSIBM.SYSDUMMY1;
Numeric Function Column
Display employee information and
additional calculated column salary +
100.000

SELECT EMPNO, FIRSTNME,
LASTNAME, SALARY, SALARY + 100000
AS FUTURE_SALARY
FROM OL37V3COL.EMPLOYEE;
Numeric Function Column
Display employee information and
additional calculated column salary
10.000

SELECT EMPNO, FIRSTNME,
LASTNAME, SALARY, SALARY - 10000
FROM OL37V3COL.EMPLOYEE;
Numeric Function Column
Display employee information and
additional calculated column named tax

SELECT EMPNO, FIRSTNME,
LASTNAME, SALARY, 0.1 * SALARY AS
TAX
FROM OL37V3COL.EMPLOYEE;
Numeric Function Round
Display employee information and
additional calculated rounding column (1
digit only)
SELECT EMPNO, FIRSTNME,
LASTNAME, BONUS, ROUND(BONUS,
0)
FROM OL37V3COL.EMPLOYEE
ORDER BY EMPNO;
Numeric Function Round
Display employee information and
additional calculated rounding column (2
digit only)

SELECT EMPNO, FIRSTNME,
LASTNAME, BONUS, ROUND(BONUS,
1)
FROM OL37V3COL.EMPLOYEE;
Numeric Function Ceiling
Display employee information and
additional calculated ceiling column
(forced to always round up)

SELECT EMPNO, FIRSTNME,
LASTNAME, BONUS, CEILING(BONUS)
FROM OL37V3COL.EMPLOYEE;
Numeric Function Floor
Display employee information and
additional calculated ceiling column
(forced to always round down)

SELECT EMPNO, FIRSTNME,
LASTNAME, BONUS, FLOOR(BONUS)
FROM OL37V3COL.EMPLOYEE;
Numeric Function Pow
Display pow function

SELECT POW(2, 2)
FROM SYSIBM.SYSDUMMY1;
Numeric Function Sqrt
Display square root function

SELECT SQRT(4)
FROM SYSIBM.SYSDUMMY1;
String Function - Like
Display employee with last name contain
er

SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE LASTNAME LIKE '%er%';
String Function - Like
Display employee with last name start with
Jo

SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE LASTNAME LIKE Jo%';
String Function - Like
Display employee with last name end with
Jo

SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE LASTNAME LIKE %Jo';
String Function - Concat
Display employee first name and last
name in one column

SELECT CONCAT(FIRSTNME,
LASTNAME) AS COMPLETENAME
FROM OL37V3COL.EMPLOYEE;
String Function - Substring
Display the first 5 letter from employee first
name

SELECT SUBSTR(FIRSTNME, 1, 5) AS
SUBSTRING
FROM OL37V3COL.EMPLOYEE;
String Function Upper case
Display first name from employee in upper
case

SELECT UCASE(FIRSTNME) AS
FIRSTNAME_UPPER
FROM OL37V3COL.EMPLOYEE;
String Function Lower case
Display first name from employee in lower
case

SELECT LCASE(FIRSTNME) AS
FIRSTNAME_LOWER
FROM OL37V3COL.EMPLOYEE;
String Function Replace
Display last name from employee but if the
last name contain Jo then replace with XX

SELECT REPLACE(LASTNAME, Jo,
XX) AS LASTNAME_REPLACED
FROM OL37V3COL.EMPLOYEE;
Date Function Current Date
Display the current date

SELECT CURDATE() AS
TANGGAL_SEKARANG
FROM SYSIBM.SYSDUMMY1;
Date Function Current Time
Display the current time

SELECT CURTIME() AS
JAM_SEKARANG
FROM SYSIBM.SYSDUMMY1;
Date Function Now
Display the current time

SELECT NOW() AS
CURRENT_DATE_TIME
FROM SYSIBM.SYSDUMMY1;
Date Function Year
Display the employee who were born in
1941

SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE YEAR(BIRTHDATE) = 1941;
Date Function Month
Display the employee who were born in
May

SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE MONTH(BIRTHDATE) = 05;
Date Function Day
Display the employee who were born 5
th
of
the month

SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE DAY(BIRTHDATE) = 05;
Summarizing Data
SQL provides five aggregate functions that
enable you to summarize table data
without retrieving every row.

By using these functions, you can find the
total number of rows in a dataset, the sum
of the values, or the highest, lowest, and
average values.
Summarizing Data - Count
Count how many employee

SELECT COUNT(*) AS
TOTAL_EMPLOYEE
FROM OL37V3COL.EMPLOYEE;
Summarizing Data - Sum
Sum all employee salary

SELECT SUM(SALARY) AS
TOTAL_SALARY
FROM OL37V3COL.EMPLOYEE;
Summarizing Data - Average
Display average employee salary

SELECT AVG(SALARY) AS
AVERAGE_SALARY
FROM OL37V3COL.EMPLOYEE;
Summarizing Data - Minimum
Display minimum employee salary

SELECT MIN(SALARY) AS
MINIMUM_SALARY
FROM OL37V3COL.EMPLOYEE;
Summarizing Data - Grouping
Display employee per department

SELECT JOB, COUNT(*) AS
TOTAL_EMPLOYEE
FROM OL37V3COL.EMPLOYEE
GROUP BY JOB;
Summarizing Data - Having
Display employee per department with
more than 5 employee

SELECT JOB, COUNT(*) AS
TOTAL_EMPLOYEE
FROM OL37V3COL.EMPLOYEE
GROUP BY JOB
HAVING COUNT(*) > 5;
Joining Data
Define relationship between table and
Foreign Key

For example relationship between NILAI
and MAHASISWA
Joining Data Type of Join
Inner Join
Cross Join
Self Join
Left Join
Right Join
Joining Data Type of Join

Joining Data Inner Join
Join between NILAI and MAHASISWA

SELECT *
FROM QRYLIB.AGSNIL n
INNER JOIN QRYLIB.AGSMHS m ON
n.KDMHS = m.KDMHS;
Joining Data Left Join
Join between NILAI and MAHASISWA

SELECT *
FROM QRYLIB.AGSNIL n
LEFT JOIN QRYLIB.AGSMHS m ON
n.KDMHS = m.KDMHS;
Combining Data - Union
Combine 2 query into 1 result
SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE LASTNAME LIKE '%er%
UNION
SELECT *
FROM OL37V3COL.EMPLOYEE
WHERE LASTNAME LIKE %Jo%

List of Aggregate Functions
AVG
The AVG function returns the average of a
set of numbers.

CORRELATION
The CORRELATION function returns the
coefficient of the correlation of a set of
number pairs.
List of Aggregate Functions
COUNT
The COUNT function returns the number
of rows or values in a set of rows or
values.
COUNT_BIG
The COUNT_BIG function returns the
number of rows or values in a set of rows
or values. It is similar to COUNT except
that the result can be greater than the
maximum value of an integer.
List of Aggregate Functions
COVARIANCE or COVARIANCE_SAMP
The COVARIANCE and
COVARIANCE_SAMP functions return the
covariance (population) of a set of number
pairs.

MAX
The MAX function returns the maximum
value in a set of values.
List of Aggregate Functions
MIN
The MIN function returns the minimum
value in a set of values.

STDDEV or STDDEV_SAMP
The STDDEV or STDDEV_SAMP function
returns the standard deviation (/n), or the
sample standard deviation (/n-1), of a set
of numbers.
List of Aggregate Functions
SUM
The SUM function returns the sum of a set
of numbers.

VARIANCE or VARIANCE_SAMP
The VARIANCE function returns the
biased variance (/n) of a set of numbers.
The VARIANCE_SAMP function returns
the sample variance (/n-1) of a set of
numbers.
List of Aggregate Functions
XMLAGG
The XMLAGG function returns an XML
sequence that contains an item for each
non-null value in a set of XML values.

List of Scalar Functions
ABS
The ABS function returns the absolute
value of a number.

ACOS
The ACOS function returns the arc cosine
of the argument as an angle, expressed in
radians. The ACOS and COS functions
are inverse operations.
List of Scalar Functions
ADD_MONTHS
The ADD_MONTHS function returns a
date that represents expression plus a
specified number of months.

ASCII
The ASCII function returns the leftmost
character of the argument as an integer.
List of Scalar Functions
ASCII_CHR
The ASCII_CHR function returns the
character that has the ASCII code value
that is specified by the argument.

ASCII_STR
The ASCII_STR function returns an ASCII
version of the string in the system ASCII
CCSID.

List of Scalar Functions
ASIN
The ASIN function returns the arc sine of
the argument as an angle, expressed in
radians. The ASIN and SIN functions are
inverse operations.
ATAN
The ATAN function returns the arc tangent
of the argument as an angle, expressed in
radians. The ATAN and TAN functions are
inverse operations.
ATANH
The ATANH function returns the
hyperbolic arc tangent of a number,
expressed in radians. The ATANH and
TANH functions are inverse operations.
ATAN2
The ATAN2 function returns the arc
tangent of x and y coordinates as an
angle, expressed in radians.
BIGINT
The BIGINT function returns a big integer
representation of either a number or a
character or graphic string representation
of a number.
BINARY
The BINARY function returns a BINARY
(fixed-length binary string) representation
of a string of any type or of a row ID type.
BITAND, BITANDNOT, BITOR, BITXOR,
and BITNOT
The bit manipulation functions operate on
the twos complement representation of the
integer value of the input arguments. The
functions return the result as a
corresponding base 10 integer value in a
data type that is based on the data type of
the input arguments.
BLOB
The BLOB function returns a BLOB
representation of a string of any type or of
a row ID type.
CCSID_ENCODING
The CCSID_ENCODING function returns
a string value that indicates the encoding
scheme of a CCSID that is specified by
the argument.
CEILING
The CEILING function returns the smallest
integer value that is greater than or equal
to the argument.
CHAR
The CHAR function returns a fixed-length
character string representation of the
argument.
CHARACTER_LENGTH
The CHARACTER_LENGTH function
returns the length of the first argument in
the specified string unit.
CLOB
The CLOB function returns a CLOB
representation of a string.
COALESCE
The COALESCE function returns the value
of the first nonnull expression.
COLLATION_KEY
The COLLATION_KEY function returns a
varying-length binary string that represents
the collation key of the argument in the
specified collation.
COMPARE_DECFLOAT
The COMPARE_DECFLOAT function
returns a SMALLINT value that indicates
whether the two arguments are equal or
unordered, or whether one argument is
greater than the other.
CONCAT
The CONCAT function combines two
compatible string arguments.
CONTAINS
The CONTAINS function searches a text
search index using criteria that are
specified in a search argument and returns
a result about whether or not a match was
found.
COS
The COS function returns the cosine of the
argument, where the argument is an
angle, expressed in radians. The COS and
ACOS functions are inverse operations.
COSH
The COSH function returns the hyperbolic
cosine of the argument, where the
argument is an angle, expressed in
radians.
DATE
The DATE function returns a date that is
derived from a value.
DAY
The DAY function returns the day part of a
value.
DAYOFMONTH
The DAYOFMONTH function returns the
day part of a value. The function is similar
to the DAY function, except
DAYOFMONTH does not support a date
or timestamp duration as an argument.
DAYOFWEEK
The DAYOFWEEK function returns an
integer, in the range of 1 to 7, that
represents the day of the week, where 1 is
Sunday and 7 is Saturday. The
DAYOFWEEK function is similar to the
DAYOFWEEK_ISO function.
DAYOFWEEK_ISO
The DAYOFWEEK_ISO function returns
an integer, in the range of 1 to 7, that
represents the day of the week, where 1 is
Monday and 7 is Sunday. The
DAYOFWEEK_ISO function is similar to
the DAYOFWEEK function.
DAYOFYEAR
The DAYOFYEAR function returns an
integer, in the range of 1 to 366, that
represents the day of the year, where 1 is
January 1.
DAYS
The DAYS function returns an integer
representation of a date.
DBCLOB
The DBCLOB function returns a DBCLOB
representation of a character string value
(with the single-byte characters converted
to double-byte characters) or a graphic
string value.
DECFLOAT
The DECFLOAT function returns a
decimal floating-point representation of
either a number or a character string
representation of a number, a decimal
number, an integer, a floating-point
number, or a decimal floating-point
number.
DECFLOAT_FORMAT
The DECFLOAT_FORMAT function
returns a DECFLOAT(34) value that is
based on the interpretation of the input
string using the specified format.
DECFLOAT_SORTKEY
The DECFLOAT_SORTKEY function
returns a binary value that can be used
when sorting DECFLOAT values. The
sorting occurs in a manner that is
consistent with the IEEE 754R
specification on total ordering.
DECIMAL or DEC
The DECIMAL function returns a decimal
representation of either a number or a
character-string or graphic-string
representation of a number, an integer, or
a decimal number.
DECODE
The DECODE function compares each
expression2 to expression1. If expression1
is equal to expression2, or both
expression1 and expression2 are null, the
value of the result-expression is returned.
If no expression2 matches expression1,
the value of else-expression is returned.
Otherwise a null value is returned.
DECRYPT_BINARY, DECRYPT_BIT,
DECRYPT_CHAR, and DECRYPT_DB
The decryption functions return a value
that is the result of decrypting encrypted
data. The decryption functions can decrypt
only values that are encrypted by using
the ENCRYPT_TDES function.
DEGREES
The DEGREES function returns the
number of degrees of the argument, which
is an angle, expressed in radians.
DIFFERENCE
The DIFFERENCE function returns a
value, from 0 to 4, that represents the
difference between the sounds of two
strings, based on applying the SOUNDEX
function to the strings. A value of 4 is the
best possible sound match.
DIGITS
The DIGITS function returns a character
string representation of the absolute value
of a number.
DOUBLE_PRECISION or DOUBLE
The DOUBLE_PRECISION and DOUBLE
functions returns a floating-point
representation of either a number or a
character-string or graphic-string
representation of a number, an integer, a
decimal number, or a floating-point
number.
DSN_XMLVALIDATE
The DSN_XMLVALIDATE function returns
an XML value that is the result of applying
XML schema validation to the first
argument of the function.
DSN_XMLVALIDATE can validate XML
data that has a maximum length of 2 GB -
1 byte.
EBCDIC_CHR
The EBCDIC_CHR function returns the
character that has the EBCDIC code value
that is specified by the argument.
EBCDIC_STR
The EBCDIC_STR function returns a
string, in the system EBCDIC CCSID, that
is an EBCDIC version of the string.
ENCRYPT_TDES
The ENCRYPT_TDES function returns a
value that is the result of encrypting the
first argument by using the Triple DES
encryption algorithm. The function can
also set the password that is used for
encryption.
EXP
The EXP function returns a value that is
the base of the natural logarithm (e),
raised to a power that is specified by the
argument. The EXP and LN functions are
inverse operations.
EXTRACT
The EXTRACT function returns a portion
of a date or timestamp, based on its
arguments.
FLOAT
The FLOAT function returns a floating-
point representation of either a number or
a string representation of a number.
FLOAT is a synonym for the DOUBLE
function.
FLOOR
The FLOOR function returns the largest
integer value that is less than or equal to
the argument.
GENERATE_UNIQUE
The GENERATE_UNIQUE function
returns a bit data character string that is
unique, compared to any other execution
of the same function.
GETHINT
The GETHINT function returns a hint for
the password if a hint was embedded in
the encrypted data. A password hint is a
phrase that helps you remember the
password with which the data was
encrypted. For example, 'Ocean' might be
used as a hint to help remember the
password 'Pacific'.
GETVARIABLE
The GETVARIABLE function returns a
varying-length character-string
representation of the current value of the
session variable that is identified by the
argument.
GRAPHIC
The GRAPHIC function returns a fixed-
length graphic-string representation of a
character string or a graphic string value,
depending on the type of the first
argument.
HEX
The HEX function returns a hexadecimal
representation of a value.
HOUR
The HOUR function returns the hour part
of a value.
IDENTITY_VAL_LOCAL
The IDENTITY_VAL_LOCAL function
returns the most recently assigned value
for an identity column.
IFNULL
The IFNULL function returns the first
nonnull expression.
INSERT
The INSERT function returns a string
where, beginning at start in source-string,
length characters have been deleted and
insert-string has been inserted.
INTEGER or INT
The INTEGER function returns an integer
representation of either a number or a
character string or graphic string
representation of an integer.
JULIAN_DAY
The JULIAN_DAY function returns an
integer value that represents a number of
days from January 1, 4713 B.C. (the start
of the Julian date calendar) to the date
that is specified in the argument.
LAST_DAY
The LAST_DAY scalar function returns a
date that represents the last day of the
month of the date argument.
LCASE
The LCASE function returns a string in
which all the characters are converted to
lowercase characters.
LEFT
The LEFT function returns a string that
consists of the specified number of
leftmost bytes of the specified string units.
LENGTH
The LENGTH function returns the length
of a value.
LN
The LN function returns the natural
logarithm of the argument. The LN and
EXP functions are inverse operations.
LOCATE
The LOCATE function returns the position
at which the first occurrence of an
argument starts within another argument.
LOCATE_IN_STRING
The LOCATE_IN_STRING function
returns the position at which an argument
starts within a specified string.
LOG10
The LOG10 function returns the common
logarithm (base 10) of a number.
LOWER
The LOWER function returns a string in
which all the characters are converted to
lowercase characters.
LPAD
The LPAD function returns a string that is
composed of string-expression that is
padded on the left, with pad or blanks. The
LPAD function treats leading or trailing
blanks in string-expression as significant.
LTRIM
The LTRIM function removes bytes from
the beginning of a string expression based
on the content of a trim expression.
MAX
The MAX scalar function returns the
maximum value in a set of values.
MICROSECOND
The MICROSECOND function returns the
microsecond part of a value.
MIDNIGHT_SECONDS
The MIDNIGHT_SECONDS function
returns an integer, in the range of 0 to
86400, that represents the number of
seconds between midnight and the time
that is specified in the argument.
MIN
The MIN scalar function returns the
minimum value in a set of values.
MINUTE
The MINUTE function returns the minute
part of a value.
MOD
The MOD function divides the first
argument by the second argument and
returns the remainder.
MONTH
The MONTH function returns the month
part of a value.
MONTHS_BETWEEN
The MONTHS_BETWEEN function
returns an estimate of the number of
months between two arguments.
MQREAD
The MQREAD function returns a message
from a specified MQSeries location
without removing the message from the
queue.
MQREADCLOB
The MQREADCLOB function returns a
message from a specified MQSeries
location without removing the message
from the queue.
MQRECEIVE
The MQRECEIVE function returns a
message from a specified MQSeries
location and removes the message from
the queue.
MQRECEIVECLOB
The MQRECEIVECLOB function returns a
message from a specified MQSeries
location and removes the message from
the queue.
MQSEND
The MQSEND function sends data to a
specified MQSeries location, and returns a
varying-length character string that
indicates whether the function was
successful or unsuccessful.
MULTIPLY_ALT
The MULTIPLY_ALT scalar function
returns the product of the two arguments.
This function is an alternative to the
multiplication operator and is especially
useful when the sum of the precisions of
the arguments exceeds 31.
NEXT_DAY
The NEXT_DAY function returns a
datetime value that represents the first
weekday, named by string-expression,
that is later than the date in expression.
NORMALIZE_DECFLOAT
The NORMALIZE_DECFLOAT function
returns a DECFLOAT value that is the
result of the argument, set to its simplest
form. That is, a non-zero number that has
any trailing zeros in the coefficient has
those zeros removed by dividing the
coefficient by the appropriate power of ten
and adjusting the exponent accordingly. A
zero has its exponent set to 0.
NORMALIZE_STRING
The NORMALIZE_STRING function takes
a Unicode string argument and returns a
normalized string that can be used for
comparison.
NULLIF
The NULLIF function returns the null value
if the two arguments are equal; otherwise,
it returns the value of the first argument.
NVL
The NVL function returns the first
argument that is not null.
OVERLAY
The OVERLAY function returns a string
that is composed of one argument that is
inserted into another argument at the
same position where some number of
bytes have been deleted.
PACK
The PACK function returns a binary string
value that contains a data type array and a
packed representation of each non-null
expression argument.
POSITION
The POSITION function returns the
position of the first occurrence of an
argument within another argument, where
the position is expressed in terms of the
string units that are specified.
POSSTR
The POSSTR function returns the position
of the first occurrence of an argument
within another argument.
POWER
The POWER function returns the value
of the first argument to the power of the
second argument.
QUANTIZE
The QUANTIZE function returns a
DECFLOAT value that is equal in value
(except for any rounding) and sign to the
first argument and that has an exponent
that is set to equal the exponent of the
second argument.
QUARTER
The QUARTER function returns an integer
between 1 and 4 that represents the
quarter of the year in which the date
resides. For example, any dates in
January, February, or March return the
integer 1.
RADIANS
The RADIANS function returns the number
of radians for an argument that is
expressed in degrees.
RAISE_ERROR
The RAISE_ERROR function causes the
statement that invokes the function to
return an error with the specified
SQLSTATE (along with SQLCODE -438)
and error condition. The RAISE_ERROR
function always returns the null value with
an undefined data type.
RAND
The RAND function returns a random
floating-point value between 0 and 1. An
argument can be specified as an optional
seed value.
REAL
The REAL function returns a single-
precision floating-point representation of
either a number or a string representation
of a number.
REPEAT
The REPEAT function returns a character
string that is composed of an argument
that is repeated a specified number of
times.
REPLACE
The REPLACE function replaces all
occurrences of search-string in source-
string with replace-string. If search-string
is not found in source-string, source-string
is returned unchanged.
RID
The RID function returns the record ID
(RID) of a row. The RID is used to
uniquely identify a row.
RIGHT
The RIGHT function returns a string that
consists of the specified number of
rightmost bytes or specified string unit
from a string.
ROUND
The ROUND function returns a number
that is rounded to the specified number of
places to the right or left of the decimal
place.
ROUND_TIMESTAMP
The ROUND_TIMESTAMP scalar function
returns a timestamp that is rounded to the
unit that is specified by the timestamp
format string.
ROWID
The ROWID function returns a row ID
representation of its argument.
RPAD
The RPAD function returns a string that is
padded on the right with blanks or a
specified string.
RTRIM
The RTRIM function removes bytes from
the end of a string expression based on
the content of a trim expression.
SCORE
The SCORE function searches a text
search index using criteria that are
specified in a search argument and returns
a relevance score that measures how well
a document matches the query.
SECOND
The SECOND function returns the
seconds part of a value with optional
fractional seconds.
SIGN
The SIGN function returns an indicator of
the sign of the argument.
SIN
The SIN function returns the sine of the
argument, where the argument is an
angle, expressed in radians.
SINH
The SINH function returns the hyperbolic
sine of the argument, where the argument
is an angle, expressed in radians.
SMALLINT
The SMALLINT function returns a small
integer representation either of a number
or of a string representation of a number.
SOUNDEX
The SOUNDEX function returns a 4-
character code that represents the sound
of the words in the argument. The result
can be compared to the results of the
SOUNDEX function of other strings.
SOAPHTTPC and SOAPHTTPV
The SOAPHTTPC function returns a
CLOB representation of XML data that
results from a SOAP request to the web
service that is specified by the first
argument. The SOAPHTTPV function
returns a VARCHAR representation of
XML data that results from a SOAP
request to the web service that is specified
by the first argument.
SOAPHTTPNC and SOAPHTTPNV
The SOAPHTTPNC and SOAPHTTPNV
functions allow you to specify a complete
SOAP message as input and to return
complete SOAP messages from the
specified web service. The returned SOAP
messages are CLOB or VARCHAR
representations of the returned XML data.
SPACE
The SPACE function returns a character
string that consists of the number of SBCS
blanks that the argument specifies.
SQRT
The SQRT function returns the square root
of the argument.
STRIP
The STRIP function removes blanks or
another specified character from the end,
the beginning, or both ends of a string
expression.
SUBSTR
The SUBSTR function returns a substring
of a string.
SUBSTRING
The SUBSTRING function returns a
substring of a string.
TAN
The TAN function returns the tangent of
the argument, where the argument is an
angle, expressed in radians.
TANH
The TANH function returns the hyperbolic
tangent of the argument, where the
argument is an angle, expressed in
radians.
TIME
The TIME function returns a time that is
derived from a value.
TIMESTAMP
The TIMESTAMP function returns a
TIMESTAMP WITHOUT TIME ZONE
value from its argument or arguments.
TIMESTAMPADD
The TIMESTAMPADD function returns the
result of adding the specified number of
the designated interval to the timestamp
value.
TIMESTAMP_FORMAT
The TIMESTAMP_FORMAT function
returns a TIMESTAMP WITHOUT TIME
ZONE value that is based on the
interpretation of the input string using the
specified format.
TIMESTAMP_ISO
The TIMESTAMP_ISO function returns a
timestamp value that is based on a date, a
time, or a timestamp argument.
TIMESTAMPDIFF
The TIMESTAMPDIFF function returns an
estimated number of intervals of the type
that is defined by the first argument, based
on the difference between two
timestamps.
TIMESTAMP_TZ
The TIMESTAMP_TZ function returns a
TIMESTAMP WITH TIME ZONE value
from the input arguments.
TO_CHAR
The TO_CHAR function returns a
character string representation of a
timestamp value that has been formatted
using a specified character template.
TO_DATE
The TO_DATE function returns a
timestamp value that is based on the
interpretation of the input string using the
specified format.
TO_NUMBER
The TO_NUMBER function returns a
DECFLOAT(34) value that is based on the
interpretation of the input string using the
specified format.
TOTALORDER
The TOTALORDER function returns an
ordering for DECFLOAT values. The
TOTALORDER function returns a small
integer value that indicates how
expression1 compares with expression2.
TRANSLATE
The TRANSLATE function returns a value
in which one or more characters of the first
argument might have been converted to
other characters.
TRIM
The TRIM function removes bytes from the
beginning, from the end, or from both the
beginning and end of a string expression.
TRUNCATE or TRUNC
The TRUNCATE function returns the first
argument, truncated as specified.
Truncation is to the number of places to
the right or left of the decimal point this is
specified by the second argument.
TRUNC_TIMESTAMP
The TRUNC_TIMESTAMP function
returns a TIMESTAMP WITHOUT TIME
ZONE value that is the expression,
truncated to the unit that is specified by
the format-string.
UCASE
The UCASE function returns a string in
which all the characters have been
converted to uppercase characters, based
on the CCSID of the argument. The
UCASE function is identical to the UPPER
function.
UNICODE
The UNICODE function returns the
Unicode UTF-16 code value of the
leftmost character of the argument as an
integer.
UNICODE_STR
The UNICODE_STR function returns a
string in Unicode UTF-8 or UTF-16,
depending on the specified option. The
string represents a Unicode encoding of
the input string.
UPPER
The UPPER function returns a string in
which all the characters have been
converted to uppercase characters.
VALUE
The VALUE function returns the value of
the first non-null expression.
VARBINARY
The VARBINARY function returns a
VARBINARY (varying-length binary string)
representation of a string of any type.
VARCHAR
The VARCHAR function returns a varying-
length character string representation of
the value specified by the first argument.
The first argument can be a character
string, a graphic string, a datetime value,
an integer number, a decimal number, a
floating-point number, or a row ID value.
VARCHAR_FORMAT
The VARCHAR_FORMAT function returns
a character string representation of the
first argument in the format indicated by
format-string.
VARGRAPHIC
The VARGRAPHIC function returns a
varying-length graphic string
representation of a the first argument. The
first argument can be a character string
value or a graphic string value.
VERIFY_GROUP_FOR_USER
The VERIFY_GROUP_FOR_USER
function returns a value that indicates
whether the primary authorization ID and
the secondary authorization IDs that are
associated with the first argument are in
the authorization names that are specified
in the list of the second argument.
VERIFY_ROLE_FOR_USER
The VERIFY_ROLE_FOR_USER function
returns a value that indicates whether the
roles that are associated with the
authorization ID that is specified in the first
argument are included in the role names
that are specified in the list of the second
argument.
VERIFY_TRUSTED_CONTEXT_ROLE_F
OR_USER
The
VERIFY_TRUSTED_CONTEXT_FOR_US
ER function returns a value that indicates
whether the authorization ID that is
associated with first argument has
acquired a role in a trusted connection and
whether that acquired role is included in
the role names that are specified in the list
of the second argument.
WEEK
The WEEK function returns an integer in
the range of 1 to 54 that represents the
week of the year. The week starts with
Sunday, and January 1 is always in the
first week.
WEEK_ISO
The WEEK_ISO function returns an
integer in the range of 1 to 53 that
represents the week of the year. The week
starts with Monday and includes seven
days. Week 1 is the first week of the year
that contains a Thursday, which is
equivalent to the first week that contains
January 4.
XMLATTRIBUTES
The XMLATTRIBUTES function constructs
XML attributes from the arguments. This
function can be used as an argument only
for the XMLELEMENT function.
XMLCOMMENT
The XMLCOMMENT function returns an
XML value with a single comment node
from a string expression. The content of
the comment node is the value of the input
string expression, mapped to Unicode
(UTF-8).
XMLCONCAT
The XMLCONCAT function returns an
XML sequence that contains the
concatenation of a variable number of
XML input arguments.
XMLDOCUMENT
The XMLDOCUMENT function returns an
XML value with a single document node
and zero or more nodes as its children.
The content of the generated XML
document node is specified by a list of
expressions.
XMLELEMENT
The XMLELEMENT function returns an
XML value that is an XML element node.
XMLFOREST
The XMLFOREST function returns an
XML value that is a sequence of XML
element nodes.
XMLMODIFY
The XMLMODIFY function returns an XML
value that might have been modified by
the evaluation of an XQuery updating
expression and XQuery variables that are
specified as input arguments.
XMLNAMESPACES
The XMLNAMESPACES function
constructs namespace declarations from
the arguments. This function can be used
as an argument only for specific functions,
such as the XMLELEMENT function and
the XMLFOREST function.
XMLPARSE
The XMLPARSE function parses the
argument as an XML document and
returns an XML value.
XMLPI
The XMLPI function returns an XML value
with a single processing instruction node.
XMLQUERY
The XMLQUERY function returns an XML
value from the evaluation of an XQuery
expression, by using specified input
arguments, a context item, and XQuery
variables.
XMLSERIALIZE
The XMLSERIALIZE function returns a
serialized XML value of the specified data
type that is generated from the first
argument.
XMLTEXT
The XMLTEXT function returns an XML
value with a single text node that contains
the value of the argument.
XMLXSROBJECTID
The XMLXSROBJECTID function returns
the XSR object identifier of the XML
schema that is used to validate the XML
document specified in the argument.
XSLTRANSFORM
The XSLTRANSFORM function
transforms an XML document into a
different data format. The output can be
any form possible for the XSLT processor,
including but not limited to XML, HTML,
and plain text.
YEAR
The YEAR function returns the year part of
a value that is a character or graphic
string. The value must be a valid string
representation of a date or timestamp.
List of Scalar Functions
ATANH
The ATANH function returns the
hyperbolic arc tangent of a number,
expressed in radians. The ATANH and
TANH functions are inverse operations.
ATAN2
The ATAN2 function returns the arc
tangent of x and y coordinates as an
angle, expressed in radians.
List of Scalar Functions
BIGINT
The BIGINT function returns a big integer
representation of either a number or a
character or graphic string representation
of a number.
BINARY
The BINARY function returns a BINARY
(fixed-length binary string) representation
of a string of any type or of a row ID type.
List of Scalar Functions
BITAND, BITANDNOT, BITOR, BITXOR,
and BITNOT
The bit manipulation functions operate on
the twos complement representation of the
integer value of the input arguments. The
functions return the result as a
corresponding base 10 integer value in a
data type that is based on the data type of
the input arguments.
List of Scalar Functions
BLOB
The BLOB function returns a BLOB
representation of a string of any type or of
a row ID type.
CCSID_ENCODING
The CCSID_ENCODING function returns
a string value that indicates the encoding
scheme of a CCSID that is specified by
the argument.
List of Scalar Functions
CEILING
The CEILING function returns the smallest
integer value that is greater than or equal
to the argument.

CHAR
The CHAR function returns a fixed-length
character string representation of the
argument.
List of Scalar Functions
CHARACTER_LENGTH
The CHARACTER_LENGTH function
returns the length of the first argument in
the specified string unit.

CLOB
The CLOB function returns a CLOB
representation of a string.
List of Scalar Functions
COALESCE
The COALESCE function returns the value
of the first nonnull expression.

COLLATION_KEY
The COLLATION_KEY function returns a
varying-length binary string that represents
the collation key of the argument in the
specified collation.
List of Scalar Functions
COMPARE_DECFLOAT
The COMPARE_DECFLOAT function
returns a SMALLINT value that indicates
whether the two arguments are equal or
unordered, or whether one argument is
greater than the other.

CONCAT
The CONCAT function combines two
compatible string arguments.
List of Scalar Functions
CONTAINS
The CONTAINS function searches a text
search index using criteria that are
specified in a search argument and returns
a result about whether or not a match was
found.
COS
The COS function returns the cosine of the
argument, where the argument is an
angle, expressed in radians.
List of Scalar Functions
COSH
The COSH function returns the hyperbolic
cosine of the argument, where the
argument is an angle, expressed in
radians.

DATE
The DATE function returns a date that is
derived from a value.
List of Scalar Functions
DAY
The DAY function returns the day part of a
value.

DAYOFMONTH
The DAYOFMONTH function returns the
day part of a value.
List of Scalar Functions
DAYOFWEEK
The DAYOFWEEK function returns an
integer, in the range of 1 to 7, that
represents the day of the week, where 1 is
Sunday and 7 is Saturday.
DAYOFWEEK_ISO
The DAYOFWEEK_ISO function returns
an integer, in the range of 1 to 7, that
represents the day of the week, where 1 is
Monday and 7 is Sunday.
List of Scalar Functions
DAYOFYEAR
The DAYOFYEAR function returns an
integer, in the range of 1 to 366, that
represents the day of the year, where 1 is
January 1.

DAYS
The DAYS function returns an integer
representation of a date.
List of Scalar Functions
DBCLOB
The DBCLOB function returns a DBCLOB
representation of a character string value
DECFLOAT
The DECFLOAT function returns a
decimal floating-point representation of
either a number or a character string
representation of a number.
List of Scalar Functions
DECFLOAT_FORMAT
The DECFLOAT_FORMAT function
returns a DECFLOAT(34) value that is
based on the interpretation of the input
string using the specified format.
DECFLOAT_SORTKEY
The DECFLOAT_SORTKEY function
returns a binary value that can be used
when sorting DECFLOAT values. The
sorting occurs in a manner that is
consistent with the IEEE 754R
specification on total ordering.
List of Scalar Functions
DECIMAL or DEC
The DECIMAL function returns a decimal
representation of either a number or a
character-string or graphic-string
representation of a number, an integer, or
a decimal number.
DECODE
The DECODE function compares each
expression2 to expression1. If expression1
is equal to expression2, or both
expression1 and expression2 are null, the
value of the result-expression is returned.
If no expression2 matches expression1,
the value of else-expression is returned.
Otherwise a null value is returned.
List of Scalar Functions
DECRYPT_BINARY, DECRYPT_BIT,
DECRYPT_CHAR, and DECRYPT_DB
The decryption functions return a value
that is the result of decrypting encrypted
data. The decryption functions can decrypt
only values that are encrypted by using
the ENCRYPT_TDES function.
DEGREES
The DEGREES function returns the
number of degrees of the argument, which
is an angle, expressed in radians.
DIFFERENCE
The DIFFERENCE function returns a
value, from 0 to 4, that represents the
difference between the sounds of two
strings, based on applying the SOUNDEX
function to the strings. A value of 4 is the
best possible sound match.
DIGITS
The DIGITS function returns a character
string representation of the absolute value
of a number.
DOUBLE_PRECISION or DOUBLE
The DOUBLE_PRECISION and DOUBLE
functions returns a floating-point
representation of either a number or a
character-string or graphic-string
representation of a number, an integer, a
decimal number, or a floating-point
number.
DSN_XMLVALIDATE
The DSN_XMLVALIDATE function returns
an XML value that is the result of applying
XML schema validation to the first
argument of the function.
DSN_XMLVALIDATE can validate XML
data that has a maximum length of 2 GB -
1 byte.
EBCDIC_CHR
The EBCDIC_CHR function returns the
character that has the EBCDIC code value
that is specified by the argument.
EBCDIC_STR
The EBCDIC_STR function returns a
string, in the system EBCDIC CCSID, that
is an EBCDIC version of the string.
ENCRYPT_TDES
The ENCRYPT_TDES function returns a
value that is the result of encrypting the
first argument by using the Triple DES
encryption algorithm. The function can
also set the password that is used for
encryption.
EXP
The EXP function returns a value that is
the base of the natural logarithm (e),
raised to a power that is specified by the
argument. The EXP and LN functions are
inverse operations.
EXTRACT
The EXTRACT function returns a portion
of a date or timestamp, based on its
arguments.
FLOAT
The FLOAT function returns a floating-
point representation of either a number or
a string representation of a number.
FLOAT is a synonym for the DOUBLE
function.
FLOOR
The FLOOR function returns the largest
integer value that is less than or equal to
the argument.
GENERATE_UNIQUE
The GENERATE_UNIQUE function
returns a bit data character string that is
unique, compared to any other execution
of the same function.
GETHINT
The GETHINT function returns a hint for
the password if a hint was embedded in
the encrypted data. A password hint is a
phrase that helps you remember the
password with which the data was
encrypted. For example, 'Ocean' might be
used as a hint to help remember the
password 'Pacific'.
GETVARIABLE
The GETVARIABLE function returns a
varying-length character-string
representation of the current value of the
session variable that is identified by the
argument.
GRAPHIC
The GRAPHIC function returns a fixed-
length graphic-string representation of a
character string or a graphic string value,
depending on the type of the first
argument.
HEX
The HEX function returns a hexadecimal
representation of a value.
HOUR
The HOUR function returns the hour part
of a value.
IDENTITY_VAL_LOCAL
The IDENTITY_VAL_LOCAL function
returns the most recently assigned value
for an identity column.
IFNULL
The IFNULL function returns the first
nonnull expression.
INSERT
The INSERT function returns a string
where, beginning at start in source-string,
length characters have been deleted and
insert-string has been inserted.
INTEGER or INT
The INTEGER function returns an integer
representation of either a number or a
character string or graphic string
representation of an integer.
JULIAN_DAY
The JULIAN_DAY function returns an
integer value that represents a number of
days from January 1, 4713 B.C. (the start
of the Julian date calendar) to the date
that is specified in the argument.
LAST_DAY
The LAST_DAY scalar function returns a
date that represents the last day of the
month of the date argument.
LCASE
The LCASE function returns a string in
which all the characters are converted to
lowercase characters.
LEFT
The LEFT function returns a string that
consists of the specified number of
leftmost bytes of the specified string units.
LENGTH
The LENGTH function returns the length
of a value.
LN
The LN function returns the natural
logarithm of the argument. The LN and
EXP functions are inverse operations.
LOCATE
The LOCATE function returns the position
at which the first occurrence of an
argument starts within another argument.
LOCATE_IN_STRING
The LOCATE_IN_STRING function
returns the position at which an argument
starts within a specified string.
LOG10
The LOG10 function returns the common
logarithm (base 10) of a number.
LOWER
The LOWER function returns a string in
which all the characters are converted to
lowercase characters.
LPAD
The LPAD function returns a string that is
composed of string-expression that is
padded on the left, with pad or blanks. The
LPAD function treats leading or trailing
blanks in string-expression as significant.
LTRIM
The LTRIM function removes bytes from
the beginning of a string expression based
on the content of a trim expression.
MAX
The MAX scalar function returns the
maximum value in a set of values.
MICROSECOND
The MICROSECOND function returns the
microsecond part of a value.
MIDNIGHT_SECONDS
The MIDNIGHT_SECONDS function
returns an integer, in the range of 0 to
86400, that represents the number of
seconds between midnight and the time
that is specified in the argument.
MIN
The MIN scalar function returns the
minimum value in a set of values.
MINUTE
The MINUTE function returns the minute
part of a value.
MOD
The MOD function divides the first
argument by the second argument and
returns the remainder.
MONTH
The MONTH function returns the month
part of a value.
MONTHS_BETWEEN
The MONTHS_BETWEEN function
returns an estimate of the number of
months between two arguments.
MQREAD
The MQREAD function returns a message
from a specified MQSeries location
without removing the message from the
queue.
MQREADCLOB
The MQREADCLOB function returns a
message from a specified MQSeries
location without removing the message
from the queue.
MQRECEIVE
The MQRECEIVE function returns a
message from a specified MQSeries
location and removes the message from
the queue.
MQRECEIVECLOB
The MQRECEIVECLOB function returns a
message from a specified MQSeries
location and removes the message from
the queue.
MQSEND
The MQSEND function sends data to a
specified MQSeries location, and returns a
varying-length character string that
indicates whether the function was
successful or unsuccessful.
MULTIPLY_ALT
The MULTIPLY_ALT scalar function
returns the product of the two arguments.
This function is an alternative to the
multiplication operator and is especially
useful when the sum of the precisions of
the arguments exceeds 31.
NEXT_DAY
The NEXT_DAY function returns a
datetime value that represents the first
weekday, named by string-expression,
that is later than the date in expression.
NORMALIZE_DECFLOAT
The NORMALIZE_DECFLOAT function
returns a DECFLOAT value that is the
result of the argument, set to its simplest
form. That is, a non-zero number that has
any trailing zeros in the coefficient has
those zeros removed by dividing the
coefficient by the appropriate power of ten
and adjusting the exponent accordingly. A
zero has its exponent set to 0.
NORMALIZE_STRING
The NORMALIZE_STRING function takes
a Unicode string argument and returns a
normalized string that can be used for
comparison.
NULLIF
The NULLIF function returns the null value
if the two arguments are equal; otherwise,
it returns the value of the first argument.
NVL
The NVL function returns the first
argument that is not null.
OVERLAY
The OVERLAY function returns a string
that is composed of one argument that is
inserted into another argument at the
same position where some number of
bytes have been deleted.
PACK
The PACK function returns a binary string
value that contains a data type array and a
packed representation of each non-null
expression argument.
POSITION
The POSITION function returns the
position of the first occurrence of an
argument within another argument, where
the position is expressed in terms of the
string units that are specified.
POSSTR
The POSSTR function returns the position
of the first occurrence of an argument
within another argument.
POWER
The POWER function returns the value
of the first argument to the power of the
second argument.
QUANTIZE
The QUANTIZE function returns a
DECFLOAT value that is equal in value
(except for any rounding) and sign to the
first argument and that has an exponent
that is set to equal the exponent of the
second argument.
QUARTER
The QUARTER function returns an integer
between 1 and 4 that represents the
quarter of the year in which the date
resides. For example, any dates in
January, February, or March return the
integer 1.
RADIANS
The RADIANS function returns the number
of radians for an argument that is
expressed in degrees.
RAISE_ERROR
The RAISE_ERROR function causes the
statement that invokes the function to
return an error with the specified
SQLSTATE (along with SQLCODE -438)
and error condition. The RAISE_ERROR
function always returns the null value with
an undefined data type.
RAND
The RAND function returns a random
floating-point value between 0 and 1. An
argument can be specified as an optional
seed value.
REAL
The REAL function returns a single-
precision floating-point representation of
either a number or a string representation
of a number.
REPEAT
The REPEAT function returns a character
string that is composed of an argument
that is repeated a specified number of
times.
REPLACE
The REPLACE function replaces all
occurrences of search-string in source-
string with replace-string. If search-string
is not found in source-string, source-string
is returned unchanged.
RID
The RID function returns the record ID
(RID) of a row. The RID is used to
uniquely identify a row.
RIGHT
The RIGHT function returns a string that
consists of the specified number of
rightmost bytes or specified string unit
from a string.
ROUND
The ROUND function returns a number
that is rounded to the specified number of
places to the right or left of the decimal
place.
ROUND_TIMESTAMP
The ROUND_TIMESTAMP scalar function
returns a timestamp that is rounded to the
unit that is specified by the timestamp
format string.
ROWID
The ROWID function returns a row ID
representation of its argument.
RPAD
The RPAD function returns a string that is
padded on the right with blanks or a
specified string.
RTRIM
The RTRIM function removes bytes from
the end of a string expression based on
the content of a trim expression.
SCORE
The SCORE function searches a text
search index using criteria that are
specified in a search argument and returns
a relevance score that measures how well
a document matches the query.
SECOND
The SECOND function returns the
seconds part of a value with optional
fractional seconds.
SIGN
The SIGN function returns an indicator of
the sign of the argument.
SIN
The SIN function returns the sine of the
argument, where the argument is an
angle, expressed in radians.
SINH
The SINH function returns the hyperbolic
sine of the argument, where the argument
is an angle, expressed in radians.
SMALLINT
The SMALLINT function returns a small
integer representation either of a number
or of a string representation of a number.
SOUNDEX
The SOUNDEX function returns a 4-
character code that represents the sound
of the words in the argument. The result
can be compared to the results of the
SOUNDEX function of other strings.
SOAPHTTPC and SOAPHTTPV
The SOAPHTTPC function returns a
CLOB representation of XML data that
results from a SOAP request to the web
service that is specified by the first
argument. The SOAPHTTPV function
returns a VARCHAR representation of
XML data that results from a SOAP
request to the web service that is specified
by the first argument.
SOAPHTTPNC and SOAPHTTPNV
The SOAPHTTPNC and SOAPHTTPNV
functions allow you to specify a complete
SOAP message as input and to return
complete SOAP messages from the
specified web service. The returned SOAP
messages are CLOB or VARCHAR
representations of the returned XML data.
SPACE
The SPACE function returns a character
string that consists of the number of SBCS
blanks that the argument specifies.
SQRT
The SQRT function returns the square root
of the argument.
STRIP
The STRIP function removes blanks or
another specified character from the end,
the beginning, or both ends of a string
expression.
SUBSTR
The SUBSTR function returns a substring
of a string.
SUBSTRING
The SUBSTRING function returns a
substring of a string.
TAN
The TAN function returns the tangent of
the argument, where the argument is an
angle, expressed in radians.
TANH
The TANH function returns the hyperbolic
tangent of the argument, where the
argument is an angle, expressed in
radians.
TIME
The TIME function returns a time that is
derived from a value.
TIMESTAMP
The TIMESTAMP function returns a
TIMESTAMP WITHOUT TIME ZONE
value from its argument or arguments.
TIMESTAMPADD
The TIMESTAMPADD function returns the
result of adding the specified number of
the designated interval to the timestamp
value.
TIMESTAMP_FORMAT
The TIMESTAMP_FORMAT function
returns a TIMESTAMP WITHOUT TIME
ZONE value that is based on the
interpretation of the input string using the
specified format.
TIMESTAMP_ISO
The TIMESTAMP_ISO function returns a
timestamp value that is based on a date, a
time, or a timestamp argument.
TIMESTAMPDIFF
The TIMESTAMPDIFF function returns an
estimated number of intervals of the type
that is defined by the first argument, based
on the difference between two
timestamps.
TIMESTAMP_TZ
The TIMESTAMP_TZ function returns a
TIMESTAMP WITH TIME ZONE value
from the input arguments.
TO_CHAR
The TO_CHAR function returns a
character string representation of a
timestamp value that has been formatted
using a specified character template.
TO_DATE
The TO_DATE function returns a
timestamp value that is based on the
interpretation of the input string using the
specified format.
TO_NUMBER
The TO_NUMBER function returns a
DECFLOAT(34) value that is based on the
interpretation of the input string using the
specified format.
TOTALORDER
The TOTALORDER function returns an
ordering for DECFLOAT values. The
TOTALORDER function returns a small
integer value that indicates how
expression1 compares with expression2.
TRANSLATE
The TRANSLATE function returns a value
in which one or more characters of the first
argument might have been converted to
other characters.
TRIM
The TRIM function removes bytes from the
beginning, from the end, or from both the
beginning and end of a string expression.
TRUNCATE or TRUNC
The TRUNCATE function returns the first
argument, truncated as specified.
Truncation is to the number of places to
the right or left of the decimal point this is
specified by the second argument.
TRUNC_TIMESTAMP
The TRUNC_TIMESTAMP function
returns a TIMESTAMP WITHOUT TIME
ZONE value that is the expression,
truncated to the unit that is specified by
the format-string.
UCASE
The UCASE function returns a string in
which all the characters have been
converted to uppercase characters, based
on the CCSID of the argument. The
UCASE function is identical to the UPPER
function.
UNICODE
The UNICODE function returns the
Unicode UTF-16 code value of the
leftmost character of the argument as an
integer.
UNICODE_STR
The UNICODE_STR function returns a
string in Unicode UTF-8 or UTF-16,
depending on the specified option. The
string represents a Unicode encoding of
the input string.
UPPER
The UPPER function returns a string in
which all the characters have been
converted to uppercase characters.
VALUE
The VALUE function returns the value of
the first non-null expression.
VARBINARY
The VARBINARY function returns a
VARBINARY (varying-length binary string)
representation of a string of any type.
VARCHAR
The VARCHAR function returns a varying-
length character string representation of
the value specified by the first argument.
The first argument can be a character
string, a graphic string, a datetime value,
an integer number, a decimal number, a
floating-point number, or a row ID value.
VARCHAR_FORMAT
The VARCHAR_FORMAT function returns
a character string representation of the
first argument in the format indicated by
format-string.
VARGRAPHIC
The VARGRAPHIC function returns a
varying-length graphic string
representation of a the first argument. The
first argument can be a character string
value or a graphic string value.
VERIFY_GROUP_FOR_USER
The VERIFY_GROUP_FOR_USER
function returns a value that indicates
whether the primary authorization ID and
the secondary authorization IDs that are
associated with the first argument are in
the authorization names that are specified
in the list of the second argument.
VERIFY_ROLE_FOR_USER
The VERIFY_ROLE_FOR_USER function
returns a value that indicates whether the
roles that are associated with the
authorization ID that is specified in the first
argument are included in the role names
that are specified in the list of the second
argument.
VERIFY_TRUSTED_CONTEXT_ROLE_F
OR_USER
The
VERIFY_TRUSTED_CONTEXT_FOR_US
ER function returns a value that indicates
whether the authorization ID that is
associated with first argument has
acquired a role in a trusted connection and
whether that acquired role is included in
the role names that are specified in the list
of the second argument.
WEEK
The WEEK function returns an integer in
the range of 1 to 54 that represents the
week of the year. The week starts with
Sunday, and January 1 is always in the
first week.
WEEK_ISO
The WEEK_ISO function returns an
integer in the range of 1 to 53 that
represents the week of the year. The week
starts with Monday and includes seven
days. Week 1 is the first week of the year
that contains a Thursday, which is
equivalent to the first week that contains
January 4.
XMLATTRIBUTES
The XMLATTRIBUTES function constructs
XML attributes from the arguments. This
function can be used as an argument only
for the XMLELEMENT function.
XMLCOMMENT
The XMLCOMMENT function returns an
XML value with a single comment node
from a string expression. The content of
the comment node is the value of the input
string expression, mapped to Unicode
(UTF-8).
XMLCONCAT
The XMLCONCAT function returns an
XML sequence that contains the
concatenation of a variable number of
XML input arguments.
XMLDOCUMENT
The XMLDOCUMENT function returns an
XML value with a single document node
and zero or more nodes as its children.
The content of the generated XML
document node is specified by a list of
expressions.
XMLELEMENT
The XMLELEMENT function returns an
XML value that is an XML element node.
XMLFOREST
The XMLFOREST function returns an
XML value that is a sequence of XML
element nodes.
XMLMODIFY
The XMLMODIFY function returns an XML
value that might have been modified by
the evaluation of an XQuery updating
expression and XQuery variables that are
specified as input arguments.
XMLNAMESPACES
The XMLNAMESPACES function
constructs namespace declarations from
the arguments. This function can be used
as an argument only for specific functions,
such as the XMLELEMENT function and
the XMLFOREST function.
XMLPARSE
The XMLPARSE function parses the
argument as an XML document and
returns an XML value.
XMLPI
The XMLPI function returns an XML value
with a single processing instruction node.
XMLQUERY
The XMLQUERY function returns an XML
value from the evaluation of an XQuery
expression, by using specified input
arguments, a context item, and XQuery
variables.
XMLSERIALIZE
The XMLSERIALIZE function returns a
serialized XML value of the specified data
type that is generated from the first
argument.
XMLTEXT
The XMLTEXT function returns an XML
value with a single text node that contains
the value of the argument.
XMLXSROBJECTID
The XMLXSROBJECTID function returns
the XSR object identifier of the XML
schema that is used to validate the XML
document specified in the argument.
XSLTRANSFORM
The XSLTRANSFORM function
transforms an XML document into a
different data format. The output can be
any form possible for the XSLT processor,
including but not limited to XML, HTML,
and plain text.
YEAR
The YEAR function returns the year part of
a value that is a character or graphic
string. The value must be a valid string
representation of a date or timestamp.
List of Scalar Functions
DIFFERENCE
The DIFFERENCE function returns a
value, from 0 to 4, that represents the
difference between the sounds of two
strings, based on applying the SOUNDEX
function to the strings. A value of 4 is the
best possible sound match.
DIGITS
The DIGITS function returns a character
string representation of the absolute value
of a number.
List of Scalar Functions
DOUBLE_PRECISION or DOUBLE
The DOUBLE_PRECISION and DOUBLE
functions returns a floating-point
representation of either a number or a
character-string or graphic-string
representation of a number, an integer, a
decimal number, or a floating-point
number.
DSN_XMLVALIDATE
The DSN_XMLVALIDATE function returns
an XML value that is the result of applying
XML schema validation to the first
argument of the function.
DSN_XMLVALIDATE can validate XML
data that has a maximum length of 2 GB -
1 byte.
List of Scalar Functions
EBCDIC_CHR
The EBCDIC_CHR function returns the
character that has the EBCDIC code value
that is specified by the argument.
EBCDIC_STR
The EBCDIC_STR function returns a
string, in the system EBCDIC CCSID, that
is an EBCDIC version of the string.
List of Scalar Functions
ENCRYPT_TDES
The ENCRYPT_TDES function returns a
value that is the result of encrypting the
first argument by using the Triple DES
encryption algorithm. The function can
also set the password that is used for
encryption.
EXP
The EXP function returns a value that is
the base of the natural logarithm (e),
raised to a power that is specified by the
argument. The EXP and LN functions are
inverse operations.
List of Scalar Functions
EXTRACT
The EXTRACT function returns a portion
of a date or timestamp, based on its
arguments.
FLOAT
The FLOAT function returns a floating-
point representation of either a number or
a string representation of a number.
FLOAT is a synonym for the DOUBLE
function.
List of Scalar Functions
FLOOR
The FLOOR function returns the largest
integer value that is less than or equal to
the argument.
GENERATE_UNIQUE
The GENERATE_UNIQUE function
returns a bit data character string that is
unique, compared to any other execution
of the same function.
List of Scalar Functions
GETHINT
The GETHINT function returns a hint for
the password if a hint was embedded in
the encrypted data. A password hint is a
phrase that helps you remember the
password with which the data was
encrypted. For example, 'Ocean' might be
used as a hint to help remember the
password 'Pacific'.
GETVARIABLE
The GETVARIABLE function returns a
varying-length character-string
representation of the current value of the
session variable that is identified by the
argument.
List of Scalar Functions
GRAPHIC
The GRAPHIC function returns a fixed-
length graphic-string representation of a
character string or a graphic string value,
depending on the type of the first
argument.
HEX
The HEX function returns a hexadecimal
representation of a value.
List of Scalar Functions
HOUR
The HOUR function returns the hour part
of a value.
IDENTITY_VAL_LOCAL
The IDENTITY_VAL_LOCAL function
returns the most recently assigned value
for an identity column.
List of Scalar Functions
IFNULL
The IFNULL function returns the first
nonnull expression.
INSERT
The INSERT function returns a string
where, beginning at start in source-string,
length characters have been deleted and
insert-string has been inserted.
List of Scalar Functions
INTEGER or INT
The INTEGER function returns an integer
representation of either a number or a
character string or graphic string
representation of an integer.
JULIAN_DAY
The JULIAN_DAY function returns an
integer value that represents a number of
days from January 1, 4713 B.C. (the start
of the Julian date calendar) to the date
that is specified in the argument.
List of Scalar Functions
LAST_DAY
The LAST_DAY scalar function returns a
date that represents the last day of the
month of the date argument.
LCASE
The LCASE function returns a string in
which all the characters are converted to
lowercase characters.
List of Scalar Functions
LEFT
The LEFT function returns a string that
consists of the specified number of
leftmost bytes of the specified string units.
LENGTH
The LENGTH function returns the length
of a value.
List of Scalar Functions
LN
The LN function returns the natural
logarithm of the argument. The LN and
EXP functions are inverse operations.
LOCATE
The LOCATE function returns the position
at which the first occurrence of an
argument starts within another argument.
List of Scalar Functions
LOCATE_IN_STRING
The LOCATE_IN_STRING function
returns the position at which an argument
starts within a specified string.
LOG10
The LOG10 function returns the common
logarithm (base 10) of a number.
List of Scalar Functions
LOWER
The LOWER function returns a string in
which all the characters are converted to
lowercase characters.
LPAD
The LPAD function returns a string that is
composed of string-expression that is
padded on the left, with pad or blanks. The
LPAD function treats leading or trailing
blanks in string-expression as significant.
List of Scalar Functions
LTRIM
The LTRIM function removes bytes from
the beginning of a string expression based
on the content of a trim expression.
MAX
The MAX scalar function returns the
maximum value in a set of values.
List of Scalar Functions
MICROSECOND
The MICROSECOND function returns the
microsecond part of a value.
MIDNIGHT_SECONDS
The MIDNIGHT_SECONDS function
returns an integer, in the range of 0 to
86400, that represents the number of
seconds between midnight and the time
that is specified in the argument.
List of Scalar Functions
MIN
The MIN scalar function returns the
minimum value in a set of values.
MINUTE
The MINUTE function returns the minute
part of a value.
List of Scalar Functions
MOD
The MOD function divides the first
argument by the second argument and
returns the remainder.
MONTH
The MONTH function returns the month
part of a value.
List of Scalar Functions
MONTHS_BETWEEN
The MONTHS_BETWEEN function
returns an estimate of the number of
months between two arguments.
MQREAD
The MQREAD function returns a message
from a specified MQSeries location
without removing the message from the
queue.
List of Scalar Functions
MQREADCLOB
The MQREADCLOB function returns a
message from a specified MQSeries
location without removing the message
from the queue.
MQRECEIVE
The MQRECEIVE function returns a
message from a specified MQSeries
location and removes the message from
the queue.
List of Scalar Functions
MQRECEIVECLOB
The MQRECEIVECLOB function returns a
message from a specified MQSeries
location and removes the message from
the queue.
MQSEND
The MQSEND function sends data to a
specified MQSeries location, and returns a
varying-length character string that
indicates whether the function was
successful or unsuccessful.
List of Scalar Functions
MULTIPLY_ALT
The MULTIPLY_ALT scalar function
returns the product of the two arguments.
This function is an alternative to the
multiplication operator and is especially
useful when the sum of the precisions of
the arguments exceeds 31.
NEXT_DAY
The NEXT_DAY function returns a
datetime value that represents the first
weekday, named by string-expression,
that is later than the date in expression.
List of Scalar Functions
NORMALIZE_DECFLOAT
The NORMALIZE_DECFLOAT function
returns a DECFLOAT value that is the
result of the argument, set to its simplest
form. That is, a non-zero number that has
any trailing zeros in the coefficient has
those zeros removed by dividing the
coefficient by the appropriate power of ten
and adjusting the exponent accordingly. A
zero has its exponent set to 0.
List of Scalar Functions
NORMALIZE_STRING
The NORMALIZE_STRING function takes
a Unicode string argument and returns a
normalized string that can be used for
comparison.
NULLIF
The NULLIF function returns the null value
if the two arguments are equal; otherwise,
it returns the value of the first argument.
List of Scalar Functions
NVL
The NVL function returns the first
argument that is not null.
OVERLAY
The OVERLAY function returns a string
that is composed of one argument that is
inserted into another argument at the
same position where some number of
bytes have been deleted.
List of Scalar Functions
PACK
The PACK function returns a binary string
value that contains a data type array and a
packed representation of each non-null
expression argument.
POSITION
The POSITION function returns the
position of the first occurrence of an
argument within another argument, where
the position is expressed in terms of the
string units that are specified.
List of Scalar Functions
POSSTR
The POSSTR function returns the position
of the first occurrence of an argument
within another argument.
POWER
The POWER function returns the value
of the first argument to the power of the
second argument.
List of Scalar Functions
QUANTIZE
The QUANTIZE function returns a
DECFLOAT value that is equal in value
(except for any rounding) and sign to the
first argument and that has an exponent
that is set to equal the exponent of the
second argument.
QUARTER
The QUARTER function returns an integer
between 1 and 4 that represents the
quarter of the year in which the date
resides. For example, any dates in
January, February, or March return the
integer 1.
List of Scalar Functions
RADIANS
The RADIANS function returns the number
of radians for an argument that is
expressed in degrees.
RAISE_ERROR
The RAISE_ERROR function causes the
statement that invokes the function to
return an error with the specified
SQLSTATE (along with SQLCODE -438)
and error condition. The RAISE_ERROR
function always returns the null value with
an undefined data type.
List of Scalar Functions
RAND
The RAND function returns a random
floating-point value between 0 and 1. An
argument can be specified as an optional
seed value.
REAL
The REAL function returns a single-
precision floating-point representation of
either a number or a string representation
of a number.
List of Scalar Functions
REPEAT
The REPEAT function returns a character
string that is composed of an argument
that is repeated a specified number of
times.
REPLACE
The REPLACE function replaces all
occurrences of search-string in source-
string with replace-string. If search-string
is not found in source-string, source-string
is returned unchanged.
List of Scalar Functions
RID
The RID function returns the record ID
(RID) of a row. The RID is used to
uniquely identify a row.
RIGHT
The RIGHT function returns a string that
consists of the specified number of
rightmost bytes or specified string unit
from a string.
List of Scalar Functions
ROUND
The ROUND function returns a number
that is rounded to the specified number of
places to the right or left of the decimal
place.
ROUND_TIMESTAMP
The ROUND_TIMESTAMP scalar function
returns a timestamp that is rounded to the
unit that is specified by the timestamp
format string.
List of Scalar Functions
ROWID
The ROWID function returns a row ID
representation of its argument.
RPAD
The RPAD function returns a string that is
padded on the right with blanks or a
specified string.
List of Scalar Functions
RTRIM
The RTRIM function removes bytes from
the end of a string expression based on
the content of a trim expression.
SCORE
The SCORE function searches a text
search index using criteria that are
specified in a search argument and returns
a relevance score that measures how well
a document matches the query.
List of Scalar Functions
SECOND
The SECOND function returns the
seconds part of a value with optional
fractional seconds.
SIGN
The SIGN function returns an indicator of
the sign of the argument.
List of Scalar Functions
SIN
The SIN function returns the sine of the
argument, where the argument is an
angle, expressed in radians.
SINH
The SINH function returns the hyperbolic
sine of the argument, where the argument
is an angle, expressed in radians.
List of Scalar Functions
SMALLINT
The SMALLINT function returns a small
integer representation either of a number
or of a string representation of a number.
SOUNDEX
The SOUNDEX function returns a 4-
character code that represents the sound
of the words in the argument. The result
can be compared to the results of the
SOUNDEX function of other strings.
List of Scalar Functions
SOAPHTTPC and SOAPHTTPV
The SOAPHTTPC function returns a
CLOB representation of XML data that
results from a SOAP request to the web
service that is specified by the first
argument. The SOAPHTTPV function
returns a VARCHAR representation of
XML data that results from a SOAP
request to the web service that is specified
by the first argument.
List of Scalar Functions
SOAPHTTPNC and SOAPHTTPNV
The SOAPHTTPNC and SOAPHTTPNV
functions allow you to specify a complete
SOAP message as input and to return
complete SOAP messages from the
specified web service. The returned SOAP
messages are CLOB or VARCHAR
representations of the returned XML data.
List of Scalar Functions
SPACE
The SPACE function returns a character
string that consists of the number of SBCS
blanks that the argument specifies.
SQRT
The SQRT function returns the square root
of the argument.
List of Scalar Functions
STRIP
The STRIP function removes blanks or
another specified character from the end,
the beginning, or both ends of a string
expression.
SUBSTR
The SUBSTR function returns a substring
of a string.
List of Scalar Functions
SUBSTRING
The SUBSTRING function returns a
substring of a string.
TAN
The TAN function returns the tangent of
the argument, where the argument is an
angle, expressed in radians.
List of Scalar Functions
TANH
The TANH function returns the hyperbolic
tangent of the argument, where the
argument is an angle, expressed in
radians.
TIME
The TIME function returns a time that is
derived from a value.
List of Scalar Functions
TIMESTAMP
The TIMESTAMP function returns a
TIMESTAMP WITHOUT TIME ZONE
value from its argument or arguments.
TIMESTAMPADD
The TIMESTAMPADD function returns the
result of adding the specified number of
the designated interval to the timestamp
value.
List of Scalar Functions
TIMESTAMP_FORMAT
The TIMESTAMP_FORMAT function
returns a TIMESTAMP WITHOUT TIME
ZONE value that is based on the
interpretation of the input string using the
specified format.
TIMESTAMP_ISO
The TIMESTAMP_ISO function returns a
timestamp value that is based on a date, a
time, or a timestamp argument.
List of Scalar Functions
TIMESTAMPDIFF
The TIMESTAMPDIFF function returns an
estimated number of intervals of the type
that is defined by the first argument, based
on the difference between two
timestamps.
TIMESTAMP_TZ
The TIMESTAMP_TZ function returns a
TIMESTAMP WITH TIME ZONE value
from the input arguments.
List of Scalar Functions
TO_CHAR
The TO_CHAR function returns a
character string representation of a
timestamp value that has been formatted
using a specified character template.
TO_DATE
The TO_DATE function returns a
timestamp value that is based on the
interpretation of the input string using the
specified format.
List of Scalar Functions
TO_NUMBER
The TO_NUMBER function returns a
DECFLOAT(34) value that is based on the
interpretation of the input string using the
specified format.
TOTALORDER
The TOTALORDER function returns an
ordering for DECFLOAT values. The
TOTALORDER function returns a small
integer value that indicates how
expression1 compares with expression2.
List of Scalar Functions
TRANSLATE
The TRANSLATE function returns a value
in which one or more characters of the first
argument might have been converted to
other characters.
TRIM
The TRIM function removes bytes from the
beginning, from the end, or from both the
beginning and end of a string expression.
List of Scalar Functions
TRUNCATE or TRUNC
The TRUNCATE function returns the first
argument, truncated as specified.
Truncation is to the number of places to
the right or left of the decimal point this is
specified by the second argument.
TRUNC_TIMESTAMP
The TRUNC_TIMESTAMP function
returns a TIMESTAMP WITHOUT TIME
ZONE value that is the expression,
truncated to the unit that is specified by
the format-string.
List of Scalar Functions
UCASE
The UCASE function returns a string in
which all the characters have been
converted to uppercase characters. The
UCASE function is identical to the UPPER
function.
UNICODE
The UNICODE function returns the
Unicode UTF-16 code value of the
leftmost character of the argument as an
integer.
List of Scalar Functions
UNICODE_STR
The UNICODE_STR function returns a
string in Unicode UTF-8 or UTF-16,
depending on the specified option. The
string represents a Unicode encoding of
the input string.
UPPER
The UPPER function returns a string in
which all the characters have been
converted to uppercase characters.
List of Scalar Functions
VALUE
The VALUE function returns the value of
the first non-null expression.
VARBINARY
The VARBINARY function returns a
VARBINARY (varying-length binary string)
representation of a string of any type.
List of Scalar Functions
VARCHAR
The VARCHAR function returns a varying-
length character string representation of
the value specified by the first argument.
The first argument can be a character
string, a graphic string, a datetime value,
an integer number, a decimal number, a
floating-point number, or a row ID value.
List of Scalar Functions
VARCHAR_FORMAT
The VARCHAR_FORMAT function returns
a character string representation of the
first argument in the format indicated by
format-string.
List of Scalar Functions
VARGRAPHIC
The VARGRAPHIC function returns a
varying-length graphic string
representation of a the first argument. The
first argument can be a character string
value or a graphic string value.
VERIFY_GROUP_FOR_USER
The VERIFY_GROUP_FOR_USER
function returns a value that indicates
whether the primary authorization ID and
the secondary authorization IDs that are
associated with the first argument are in
the authorization names that are specified
in the list of the second argument.
List of Scalar Functions
VERIFY_ROLE_FOR_USER
The VERIFY_ROLE_FOR_USER function
returns a value that indicates whether the
roles that are associated with the
authorization ID that is specified in the first
argument are included in the role names
that are specified in the list of the second
argument.
List of Scalar Functions
VERIFY_TRUSTED_CONTEXT_ROLE_F
OR_USER
The
VERIFY_TRUSTED_CONTEXT_FOR_US
ER function returns a value that indicates
whether the authorization ID that is
associated with first argument has
acquired a role in a trusted connection and
whether that acquired role is included in
the role names that are specified in the list
of the second argument.
List of Scalar Functions
WEEK
The WEEK function returns an integer in
the range of 1 to 54 that represents the
week of the year. The week starts with
Sunday, and January 1 is always in the
first week.
WEEK_ISO
The WEEK_ISO function returns an
integer in the range of 1 to 53 that
represents the week of the year. The week
starts with Monday and includes seven
days. Week 1 is the first week of the year
that contains a Thursday, which is
equivalent to the first week that contains
January 4.
List of Scalar Functions
XMLATTRIBUTES
The XMLATTRIBUTES function constructs
XML attributes from the arguments. This
function can be used as an argument only
for the XMLELEMENT function.
XMLCOMMENT
The XMLCOMMENT function returns an
XML value with a single comment node
from a string expression. The content of
the comment node is the value of the input
string expression, mapped to Unicode
(UTF-8).
List of Scalar Functions
XMLCONCAT
The XMLCONCAT function returns an
XML sequence that contains the
concatenation of a variable number of
XML input arguments.
XMLDOCUMENT
The XMLDOCUMENT function returns an
XML value with a single document node
and zero or more nodes as its children.
The content of the generated XML
document node is specified by a list of
expressions.
List of Scalar Functions
XMLELEMENT
The XMLELEMENT function returns an
XML value that is an XML element node.
XMLFOREST
The XMLFOREST function returns an
XML value that is a sequence of XML
element nodes.
XMLMODIFY
The XMLMODIFY function returns an XML
value that might have been modified by
the evaluation of an XQuery updating
expression and XQuery variables that are
specified as input arguments.
List of Scalar Functions
XMLNAMESPACES
The XMLNAMESPACES function
constructs namespace declarations from
the arguments. This function can be used
as an argument only for specific functions,
such as the XMLELEMENT function and
the XMLFOREST function.
XMLPARSE
The XMLPARSE function parses the
argument as an XML document and
returns an XML value.
List of Scalar Functions
XMLPI
The XMLPI function returns an XML value
with a single processing instruction node.
XMLQUERY
The XMLQUERY function returns an XML
value from the evaluation of an XQuery
expression, by using specified input
arguments, a context item, and XQuery
variables.
List of Scalar Functions
XMLSERIALIZE
The XMLSERIALIZE function returns a
serialized XML value of the specified data
type that is generated from the first
argument.
XMLTEXT
The XMLTEXT function returns an XML
value with a single text node that contains
the value of the argument.
List of Scalar Functions
XMLXSROBJECTID
The XMLXSROBJECTID function returns
the XSR object identifier of the XML
schema that is used to validate the XML
document specified in the argument.
XSLTRANSFORM
The XSLTRANSFORM function
transforms an XML document into a
different data format. The output can be
any form possible for the XSLT processor,
including but not limited to XML, HTML,
and plain text.
List of Scalar Functions
YEAR
The YEAR function returns the year part of
a value that is a character or graphic
string. The value must be a valid string
representation of a date or timestamp.
Thank You

Vous aimerez peut-être aussi