Scalar SQLite built-in functions

The following is a list of SQLite built-in scalar functions exposed in ECSql, see SQLite documentation for more details

Function Description
abs(X) The abs(X) function returns the absolute value of the numeric argument X. Read more.
char(X1,X2,...,XN) The char(X1,X2,...,XN) function returns a string composed of characters having the unicode code point values of integers X1 through XN, respectively.Read more.
coalesce(X,Y,...) The coalesce() function returns a copy of its first non-NULL argument, or NULL if all arguments are NULL. Read more.
format(FORMAT,...) The format(FORMAT,...) SQL function works like the sqlite3_mprintf(). Read more.
glob(X,Y) The glob(X,Y) use glob syntax. Read more.
ifnull(X,Y) The ifnull() function returns a copy of its first non-NULL argument, or NULL if both arguments are NULL. Read more.
iif(X,Y,Z) The iif(X,Y,Z) function returns the value Y if X is true, and Z otherwise. Read more.
instr(X,Y) The instr(X,Y) function finds the first occurrence of string Y within string X and returns the number of prior characters plus 1, or 0 if Y is nowhere found within X. Read more.
length(X) Return length of a value according to its type. Read more.
like(X,Y[,Z]) The like() function is used to implement the Y LIKE X [ESCAPE Z] expression. Read more.
lower(X) The lower(X) function returns a copy of string X with all ASCII characters converted to lower case. Read more.
ltrim(X,Y[,Z]) The ltrim(X,Y) function returns a string formed by removing any and all characters that appear in Y from the left side of X. Read more.
max(X,Y,...) The multi-argument max() function returns the argument with the maximum value, or return NULL if any argument is NULL. Read more.
min(X,Y,...) The multi-argument min() function returns the argument with the minimum value.Read more.
nullif(X,Y) The nullif(X,Y) function returns its first argument if the arguments are different and NULL if the arguments are the same. Read more.
octet_length(X) The octet_length(X) function returns the number of bytes in the encoding of text string X.Read more.
printf(FORMAT,...) The printf() SQL function is an alias for the format() SQL function. Read more.
quote(X) The quote(X) function returns the text of an SQL literal which is the value of its argument suitable for inclusion into an SQL statement. Read more.
random() The random() function returns a pseudo-random integer between -9223372036854775808 and +9223372036854775807. Read more.
randomblob(N) The randomblob(N) function return an N-byte blob containing pseudo-random bytes. Read more.
replace(X,Y,Z) The replace(X,Y,Z) function returns a string formed by substituting string Z for every occurrence of string Y in string X.Read more.
round(X[,Y]) The round(X,Y) function returns a floating-point value X rounded to Y digits to the right of the decimal point. Read more.
rtrim(X[,Y]) The rtrim(X,Y) function returns a string formed by removing any and all characters that appear in Y from the right side of X.Read more.
sign(X) The sign(X) function returns -1, 0, or +1 if the argument X is a numeric value that is negative, zero, or positive, respectively. Read more.
soundex(X) The soundex(X) function returns a string that is the soundex encoding of the string X. Read more.
substr(X,Y[,Z]) The substr(X,Y,Z) function returns a substring of input string X that begins with the Y-th character and which is Z characters long. Read more.
trim(X[,Y]) The trim(X,Y) function returns a string formed by removing any and all characters that appear in Y from both ends of X. Read more.
typeof(X) The typeof(X) function returns a string that indicates the datatype of the expression X: "null", "integer", "real", "text", or "blob". Read more.
unhex(X[,Y]) The unhex(X,Y) function returns a BLOB value which is the decoding of the hexadecimal string X. Read more.
upper(X) The upper(X) function returns a copy of input string X in which all lower-case ASCII characters are converted to their upper-case equivalent. Read more.

ECSql Syntax

Last Updated: 15 May, 2024