String Functions and Operators
String functions and operators process string inputs and return string or numeric values. The string types supported by Extreme DPS are varchar
and text
. For more information about the string types, see Character Types.
SQL string functions and operators
This section provides details about each SQL string functions and operators supported by Extreme DPS.
||
Concatenates one or more strings.
Null values will be ignored.
Syntax
<string1> || <string2>[, ... <string n>]
Arguments
<string n>
: a varchar
string to concatenate.
Returns
A varchar
value.
Examples
>SELECT 'Extreme' || 'DPS';
ExtremeDPS
BIT_LENGTH
Returns the length of a string in bits.
Syntax
BIT_LENGTH(<string>)
Arguments
<string>
: the varchar
string of which the length is to be evaluated.
Returns
An integer
value.
Examples
>SELECT BIT_LENGTH('Extreme DPS');
88
CHAR_LENGTH or CHARACTER_LENGTH
Returns the number of characters in a string.
CHARACTER_LENGTH
is an alias for CHAR_LENGTH
.
Syntax
CHAR_LENGTH(<string>)
CHARACTER_LENGTH(<string>)
Arguments
<string>
: the string of which the length is to be evaluated.
Returns
A integer
value.
Examples
>SELECT CHAR_LENGTH('Extreme DPS');
11
CONCAT_WS
Concatenates strings with a separator.
The first argument specified in the function is the separator. Null values will be ignored.
Syntax
CONCAT_WS( <separator>, <string1>[, <string2> ...])
Arguments
-
<separator
>: atext
string that functions as the separator. -
<string>
: atext
string to concatenate.
Returns
A text
value.
Examples
>SELECT CONCAT_WS(':', 'adbcd', 'efg', 'hijk');
'adbcd:efg:hijk'
LOWER
Converts all characters in a string to lowercase.
Syntax
LOWER(<string>)
Arguments
<string>
: the varchar
string to convert.
Returns
A varchar
value.
Examples
>SELECT LOWER('Extreme DPS');
extreme dps
OCTET_LENGTH
Returns the length of a string in bytes.
Syntax
OCTET_LENGTH(<string>)
Arguments
<string>
: the varchar
string of which the length is to be evaluated.
Returns
An integer
value.
Examples
>SELECT OCTET_LENGTH('Extreme DPS');
11