Functions for performing string manipulation.
ASCII(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: integer
Description: Returns the ASCII code value of the leftmost character of string_exp
as an integer.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringAscii]
BIT_LENGTH(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: integer
Description: Returns the length in bits of the string_exp
input expression.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringBitLength]
CHAR(code) (1)
Input:
-
integer expression between
0
and255
. Ifnull
, negative, or greater than255
, the function returnsnull
.
Output: string
Description: Returns the character that has the ASCII code value specified by the numeric input.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringChar]
CHAR_LENGTH(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: integer
Description: Returns the length in characters of the input, if the string expression is of a character data type; otherwise, returns the length in bytes of the string expression (the smallest integer not less than the number of bits divided by 8).
include-tagged::{sql-specs}/docs/docs.csv-spec[stringCharLength]
CONCAT(
string_exp1, (1)
string_exp2) (2)
Input:
-
string expression. Treats
null
as an empty string. -
string expression. Treats
null
as an empty string.
Output: string
Description: Returns a character string that is the result of concatenating string_exp1
to string_exp2
.
The resulting string cannot exceed a byte length of 1 MB.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringConcat]
INSERT(
source, (1)
start, (2)
length, (3)
replacement) (4)
Input:
-
string expression. If
null
, the function returnsnull
. -
integer expression. If
null
, the function returnsnull
. -
integer expression. If
null
, the function returnsnull
. -
string expression. If
null
, the function returnsnull
.
Output: string
Description: Returns a string where length
characters have been deleted from source
, beginning at start
, and where replacement
has been inserted into source
, beginning at start
.
The resulting string cannot exceed a byte length of 1 MB.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringInsert]
LCASE(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: string
Description: Returns a string equal to that in string_exp
, with all uppercase characters converted to lowercase.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLCase]
LEFT(
string_exp, (1)
count) (2)
Input:
-
string expression. If
null
, the function returnsnull
. -
integer expression. If
null
, the function returnsnull
. If0
or negative, the function returns an empty string.
Output: string
Description: Returns the leftmost count characters of string_exp
.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLeft]
LENGTH(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: integer
Description: Returns the number of characters in string_exp
, excluding trailing blanks.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLength]
LOCATE(
pattern, (1)
source (2)
[, start](3)
)
Input:
-
string expression. If
null
, the function returnsnull
. -
string expression. If
null
, the function returnsnull
. -
integer expression; optional. If
null
,0
,1
, negative, or not specified, the search starts at the first character position.
Output: integer
Description: Returns the starting position of the first occurrence of
pattern
within source
. The optional start
specifies the character position
to start the search with. If the pattern
is not found within source
, the
function returns 0
.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLocateWoStart]
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLocateWithStart]
LTRIM(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: string
Description: Returns the characters of string_exp
, with leading blanks removed.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLTrim]
OCTET_LENGTH(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: integer
Description: Returns the length in bytes of the string_exp
input expression.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringOctetLength]
POSITION(
string_exp1, (1)
string_exp2) (2)
Input:
-
string expression. If
null
, the function returnsnull
. -
string expression. If
null
, the function returnsnull
.
Output: integer
Description: Returns the position of the string_exp1
in string_exp2
. The result is an exact numeric.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringPosition]
REPEAT(
string_exp, (1)
count) (2)
Input:
-
string expression. If
null
, the function returnsnull
. -
integer expression. If
0
, negative, ornull
, the function returnsnull
.
Output: string
Description: Returns a character string composed of string_exp
repeated count
times.
The resulting string cannot exceed a byte length of 1 MB.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringRepeat]
REPLACE(
source, (1)
pattern, (2)
replacement) (3)
Input:
-
string expression. If
null
, the function returnsnull
. -
string expression. If
null
, the function returnsnull
. -
string expression. If
null
, the function returnsnull
.
Output: string
Description: Search source
for occurrences of pattern
, and replace with replacement
.
The resulting string cannot exceed a byte length of 1 MB.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringReplace]
RIGHT(
string_exp, (1)
count) (2)
Input:
-
string expression. If
null
, the function returnsnull
. -
integer expression. If
null
, the function returnsnull
. If0
or negative, the function returns an empty string.
Output: string
Description: Returns the rightmost count characters of string_exp
.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringRight]
RTRIM(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: string
Description: Returns the characters of string_exp
with trailing blanks removed.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringRTrim]
SPACE(count) (1)
Input:
-
integer expression. If
null
or negative, the function returnsnull
.
Output: string
Description: Returns a character string consisting of count
spaces.
The resulting string cannot exceed a byte length of 1 MB.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringSpace]
STARTS_WITH(
source, (1)
pattern) (2)
Input:
-
string expression. If
null
, the function returnsnull
. -
string expression. If
null
, the function returnsnull
.
Output: boolean value
Description: Returns true
if the source expression starts with the specified
pattern, false
otherwise. The matching is case sensitive.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringStartsWithTrue]
include-tagged::{sql-specs}/docs/docs.csv-spec[stringStartsWithFalse]
SUBSTRING(
source, (1)
start, (2)
length) (3)
Input:
-
string expression. If
null
, the function returnsnull
. -
integer expression. If
null
, the function returnsnull
. -
integer expression. If
null
, the function returnsnull
.
Output: string
Description: Returns a character string that is derived from source
, beginning at the character position specified by start
for length
characters.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringSubString]
TRIM(string_exp) (1)
Input:
-
string expression. If
null
, the function returnsnull
.
Output: string
Description: Returns the characters of string_exp
, with leading and trailing blanks removed.
include-tagged::{sql-specs}/docs/docs.csv-spec[stringTrim]