Functions on Strings

This section describes various functions on strings.

To follow along with the examples in the section, create users table that provides information about users. See the seq_distinct function in Functions on Sequences section for users table creation.

The following string functions are supported:

Table 12-7 String Functions

Function Description
substring Function Extracts a substring from a string based on a specified starting position and length.
concat Function Returns a single value of concatenating the two arguments.
upper Function Converts the characters in the string to uppercase.
lower Function Converts the characters in the string to lowercase.
trim Function Returns a string with leading, trailing, or both sets of characters trimmed.
ltrim Function Returns a string with leading characters trimmed.
rtrim Function Returns a string with trailing characters trimmed.
length Function Returns the length of the character string.
contains Function Returns a boolean indicating if the search string is present in the source string.
starts_with Function Returns a boolean indicating if the source string begins with the search string.
ends_with Function Returns a boolean indicating if the source string ends with the search string.
index_of Function Returns the position of the first character of the search string at its first occurrence.
replace Function Returns the source string with each occurrence of the search string replaced by the replacement string.
reverse Function Returns the characters of the source string in the reverse order.