This chapter contains syntax diagrams, semantic descriptions, rules, and examples of the use of the built-in functions listed in the following tables. For more information on functions, see Functions.
Function | Description | Reference |
---|---|---|
AVG | Returns the average of a set of numbers | AVG |
COUNT | Returns the number of rows or values in a set of rows or values | COUNT |
COUNT_BIG | Returns the number of rows or values in a set of rows or values (COUNT_BIG is similar to COUNT except that the result can be greater than the maximum value of integer) | COUNT_BIG |
MAX | Returns the maximum value in a set of values in a group | MAX |
MIN | Returns the minimum value in a set of values in a group | MIN |
STDDEV | Returns the biased standard deviation of a set of numbers | STDDEV_POP or STDDEV |
STDDEV_SAMP | Returns the sample standard deviation of a set of numbers | STDDEV_SAMP |
SUM | Returns the sum of a set of numbers | SUM |
VARIANCE or VAR | Returns the biased variance of a set of numbers | VAR_POP or VARIANCE or VAR |
VARIANCE_SAMP or VAR_SAMP | Returns the sample variance of a set of numbers | VARIANCE_SAMP or VAR_SAMP |
Function | Description | Reference |
---|---|---|
BIGINT | Returns a big integer representation of a number | BIGINT |
BINARY | Returns a BINARY representation of a string of any type | BINARY |
BLOB | Returns a BLOB representation of a string of any type | BLOB |
CHAR | Returns a CHARACTER representation of a value | CHAR |
CLOB | Returns a CLOB representation of a value | CLOB |
DATE | Returns a DATE from a value | DATE |
DBCLOB | Returns a DBCLOB representation of a string | DBCLOB |
DECIMAL | Returns a DECIMAL representation of a number | DECIMAL or DEC |
DOUBLE_PRECISION or DOUBLE | Returns a DOUBLE PRECISION representation of a number | DOUBLE_PRECISION or DOUBLE |
FLOAT | Returns a FLOAT representation of a number | FLOAT |
GRAPHIC | Returns a GRAPHIC representation of a string | GRAPHIC |
INTEGER or INT | Returns an INTEGER representation of a number | INTEGER or INT |
REAL | Returns a REAL representation of a number | REAL |
ROWID | Returns a Row ID from a value | ROWID |
SMALLINT | Returns a SMALLINT representation of a number | SMALLINT |
TIME | Returns a TIME from a value | TIME |
TIMESTAMP | Returns a TIMESTAMP from a value or a pair of values | TIMESTAMP |
TIMESTAMP_ISO | Returns a timestamp value from a datetime value | TIMESTAMP_ISO |
VARBINARY | Returns a VARBINARY representation of a string of any type | VARBINARY |
VARCHAR | Returns a VARCHAR representative of a value | VARCHAR |
VARGRAPHIC | Returns a VARGRAPHIC representation of a value | VARGRAPHIC |
ZONED | Returns a zoned decimal representation of a number | ZONED |
Function | Description | Reference |
---|---|---|
DLCOMMENT | Returns the comment value from a DataLink value | DLCOMMENT |
DLLINKTYPE | Returns the link type value from a DataLink value | DLLINKTYPE |
DLURLCOMPLETE | Returns the complete URL value from a DataLink value with a link type of URL | DLURLCOMPLETE |
DLURLPATH | Returns the path and file name necessary to access a file within a given server from a DataLink value with a linktype of URL | DLURLPATH |
DLURLPATHONLY | Returns the path and file name necessary to access a file within a given server from a DataLink value with a linktype of URL without a file access token | DLURLPATHONLY |
DLURLSCHEME | Returns the scheme from a DataLink value with a linktype of URL | DLURLSCHEME |
DLURLSERVER | Returns the file server from a DataLink value with a linktype of URL | DLURLSERVER |
DLVALUE | Returns a DataLink value | DLVALUE |
Function | Description | Reference |
---|---|---|
ADD_MONTHS | Returns a date that represents the date argument plus the number of months argument | ADD_MONTHS |
CURDATE | Returns a date based on a reading of the time-of-day clock | CURDATE |
CURTIME | Returns a time based on a reading of the time-of-day clock | CURTIME |
DAY | Returns the day part of a value | DAY |
DAYNAME | Returns the name of the day part of a value | DAYNAME |
DAYOFMONTH | Returns an integer that represents the day of the month | DAYOFMONTH |
DAYOFWEEK | Returns the day of the week from a value, where 1 is Sunday and 7 is Saturday | DAYOFWEEK |
DAYOFWEEK_ISO | Returns the day of the week from a value, where 1 is Monday and 7 is Sunday | DAYOFWEEK_ISO |
DAYOFYEAR | Returns the day of the year from a value | DAYOFYEAR |
DAYS | Returns an integer representation of a date | DAYS |
EXTRACT | Returns a datetime portion of a value | EXTRACT |
HOUR | Returns the hour part of a value | HOUR |
JULIAN_DAY | Returns an integer value representing a number of days from January 1, 4712 B.C. to the date specified in the argument | JULIAN_DAY |
LAST_DAY | Returns a date that represents the last day of the month of the date argument | LAST_DAY |
MICROSECOND | Returns the microsecond part of a value | MICROSECOND |
MIDNIGHT_SECONDS | Returns an integer value representing the number of seconds between midnight and a specified time value | MIDNIGHT_SECONDS |
MINUTE | Returns the minute part of a value | MINUTE |
MONTH | Returns the month part of a value | MONTH |
MONTHNAME | Returns the name of the month part of a value | MONTHNAME |
NEXT_DAY | Returns a timestamp that represents the first weekday, named by the second argument, after the date argument | NEXT_DAY |
NOW | Returns a timestamp based on a reading of the time-of-day clock | NOW |
QUARTER | Returns an integer that represents the quarter of the year in which a date resides | QUARTER |
SECOND | Returns the seconds part of a value | SECOND |
TIMESTAMPDIFF | Returns an estimated number of intervals based on the difference between two timestamps | TIMESTAMPDIFF |
VARCHAR_FORMAT | Returns a character string representation of a timestamp, with the string in a specified format | VARCHAR_FORMAT |
WEEK | Returns the week of the year from a value, where the week starts with Sunday | WEEK |
WEEK_ISO | Returns the week of the year from a value, where the week starts with Monday | WEEK_ISO |
YEAR | Returns the year part of a value | YEAR |
Function | Description | Reference |
---|---|---|
DATAPARTITIONNAME | Returns the partition name where a row is located | DATAPARTITIONNAME |
DATAPARTITIONNUM | Returns the partition number of a row | DATAPARTITIONNUM |
DBPARTITIONNAME | Returns the relational database name where a row is located | DBPARTITIONNAME |
DBPARTITIONNUM | Returns the node number of a row | DBPARTITIONNUM |
HASH | Returns the partition number of a set of values | HASH |
HASHED_VALUE | Returns the partition map index number of a row | HASHED_VALUE |
Function | Description | Reference |
---|---|---|
COALESCE | Returns the first argument that is not null | COALESCE |
DATABASE | Returns the current server | DATABASE |
GENERATE_UNIQUE | Returns a bit character string that is unique compared to any other execution of the function | GENERATE_UNIQUE |
HEX | Returns a hexadecimal representation of a value | HEX |
IDENTITY_VAL_LOCAL | Returns the most recently assigned value for an identity column | IDENTITY_VAL_LOCAL |
IFNULL | Returns the first argument that is not null | IFNULL |
LENGTH | Returns the length of a value | LENGTH |
MAX | Returns the maximum value in a set of values | MAX |
MIN | Returns the minimum value in a set of values | MIN |
NULLIF | Returns a null value if the arguments are equal, otherwise it returns the value of the first argument | NULLIF |
RAISE_ERROR | Raises an error with the specified SQLSTATE and message text | RAISE_ERROR |
RRN | Returns the relative record number of a row | RRN |
VALUE | Returns the first argument that is not null | VALUE |
Function | Description | Reference |
---|---|---|
ABS | Returns the absolute value of a number | ABS |
ACOS | Returns the arc cosine of a number, in radians | ACOS |
ANTILOG | Returns the anti-logarithm (base 10) of a number | ANTILOG |
ASIN | Returns the arc sine of a number, in radians | ASIN |
ATAN | Returns the arc tangent of a number, in radians | ATAN |
ATANH | Returns the hyperbolic arc tangent of a number, in radians | ATANH |
ATAN2 | Returns the arc tangent of x and y coordinates as an angle expressed in radians | ATAN2 |
CEILING | Returns the smallest integer value that is greater than or equal to a number | CEILING |
COS | Returns the cosine of a number | COS |
COSH | Returns the hyperbolic cosine of a number | COSH |
COT | Returns the cotangent of a number | COT |
DEGREE | Returns the number of degrees of an angle | DEGREES |
DIGITS | Returns a character-string representation of the absolute value of a number | DIGITS |
EXP | Returns a value that is the base of the natural logarithm (e) raised to a power specified by the argument | EXP |
FLOOR | Returns the largest integer value that is less than or equal to a number | FLOOR |
LN | Returns the natural logarithm of a number | LN |
LOG10 | Returns the common logarithm (base 10) of a number | LOG10 |
MOD | Returns the remainder of the first argument divided by the second argument | MOD |
MULTIPLY_ALT | Multiplies the first argument by the second argument and returns the product | MULTIPLY_ALT |
PI | Returns the value of π | PI |
POWER | Returns the result of raising the first argument to the power of the second argument | POWER |
RADIANS | Returns the number of radians for an argument that is expressed in degrees | RADIANS |
RAND | Returns a random number | RAND |
ROUND | Returns a numeric value that has been rounded to the specified number of decimal places | ROUND |
SIGN | Returns the sign of a number | SIGN |
SIN | Returns the sine of a number | SIN |
SINH | Returns the hyperbolic sine of a number | SINH |
SQRT | Returns the square root of a number | SQRT |
TAN | Returns the tangent of a number | TAN |
TANH | Returns the hyperbolic tangent of a number | TANH |
TRUNCATE or TRUNC | Returns a number value that has been truncated at a specified number of decimal places | TRUNCATE or TRUNC |
Function | Description | Reference |
---|---|---|
BIT_LENGTH | Returns the length of a string expression in bit | BIT_LENGTH |
CHARACTER_LENGTH | Returns the length of a string expression | CHARACTER_LENGTH |
CONCAT | Returns a string that is the concatenation of two strings | CONCAT |
DECRYPT_BIT, DECRYPT_BINARY, DECRYPT_CHAR, and DECRYPT_DB | Decrypts an encrypted string | DECRYPT_BIT, DECRYPT_BINARY, DECRYPT_CHAR and DECRYPT_DB |
DIFFERENCE | Returns a value representing the difference between the sounds of two strings | DIFFERENCE |
ENCRYPT and ENCRYPT_RC2 | Encrypts a string using the RC2 encryption algorithm | ENCRYPT_RC2 |
ENCRYPT_TDES | Encrypts a string using the Triple DES encryption algorithm | ENCRYPT_TDES |
GETHINT | Returns a hint from an encrypted string | GETHINT |
INSERT | Returns a string where a substring is deleted and a new string inserted in its place | INSERT |
LAND | Returns a string that is the logical AND of the argument strings | LAND |
LCASE | Returns a string in which all the characters have been converted to lowercase characters | LCASE |
LEFT | Returns the leftmost characters from the string | LEFT |
LNOT | Returns a string that is the logical NOT of the argument string | LNOT |
LOCATE | Returns the starting position of one string within another string | LOCATE |
LOR | Returns a string that is the logical OR of the argument strings | LOR |
LOWER | Returns a string in which all the characters have been converted to lowercase characters | LOWER |
LTRIM | Returns a string in which blanks or hexadecimal zeroes have been removed from the beginning of another string | LTRIM |
OCTET_LENGTH | Returns the length of a string expression in octets | OCTET_LENGTH |
POSITION or POSSTR | Returns the starting position of one string within another string | POSITION or POSSTR |
REPEAT | Returns a string composed of another string repeated a number of times | REPEAT |
REPLACE | Returns a string where all occurrences of one string are replaced by another string | REPLACE |
RIGHT | Returns the rightmost characters from the string | RIGHT |
RTRIM | Returns a string in which blanks or hexadecimal zeroes have been removed from the end of another string | RTRIM |
SOUNDEX | Returns a character code representing the sound of the words in the argument | SOUNDEX |
SPACE | Returns a character string that consists of a specified number of blanks | SPACE |
STRIP | Removes blanks or another specified character from the end or beginning of a string expression | STRIP |
SUBSTRING or SUBSTR | Returns a substring of a string | SUBSTRING or SUBSTR |
TRANSLATE | Returns a string in which one or more characters in a string are converted to other characters | TRANSLATE |
TRIM | Removes blanks or another specified character from the end or beginning of a string expression | TRIM |
UCASE | Returns a string in which all the characters have been converted to uppercase characters | UCASE |
UPPER | Returns a string in which all the characters have been converted to uppercase characters | UPPER |
XOR | Returns a string that is the logical XOR of the argument strings | XOR |