8.3. String Functions
8.3.1. ASCII_CHAR()
Available inDSQL, PSQL
Possible name conflictYES → Read details
Result typeCHAR(1) CHARACTER SET NONE
Syntax
|
ASCII_CHAR (code)
ASCII_CHAR
Function ParameterParameter | Description |
---|---|
code | An integer within the range from 0 to 255 |
Returns the ASCII character corresponding to the number passed in the argument.
If you are used to the behaviour of the
ASCII_CHAR
UDF, which returns an empty string if the argument is 0, please notice that the internal function correctly returns a character with ASCII code 0 here.
8.3.2. ASCII_VAL()
Available inDSQL, PSQL
Possible name conflictYES → Read details
Result typeSMALLINT
Syntax
|
ASCII_VAL (ch)
ASCII_VAL
Function ParameterParameter | Description |
---|---|
ch | A string of the |
Returns the ASCII code of the character passed in.
If the argument is a string with more than one character, the ASCII code of the first character is returned.
If the argument is an empty string, 0 is returned.
If the argument is
NULL
,NULL
is returned.If the first character of the argument string is multi-byte, an error is raised. (A bug in Firebird 2.1 - 2.1.3 and 2.5.0 causes an error to be raised if any character in the string is multi-byte. This is fixed in versions 2.1.4 and 2.5.1.)
8.3.3. BIT_LENGTH()
Available inDSQL, PSQL
Result typeINTEGER
Syntax
|
BIT_LENGTH (string)
BIT_LENGTH
Function ParameterParameter | Description |
---|---|
string | An expression of a string type |
Gives the length in bits of the input string.
For multi-byte character sets, this may be less than the number of characters times 8 times the formal
number of bytes per character as found in RDB$CHARACTER_SETS
.
With arguments of type CHAR
, this function takes the entire formal string length (i.e. the declared length of a field or variable) into account.
If you want to obtain the logical
bit length, not counting the trailing spaces, right-TRIM
the argument before passing it to BIT_LENGTH
.
BLOB
supportSince Firebird 2.1, this function fully supports text BLOB
s of any length and character set.
8.3.3.1. BIT_LENGTH
Examples
|select bit_length('Hello!') from rdb$database
|-- returns 48
||
select bit_length(_iso8859_1 'Grüß di!') from rdb$database
|-- returns 64: ü and ß take up one byte each in ISO8859_1
||
select bit_length
|(cast (_iso8859_1 'Grüß di!' as varchar(24) character set utf8))
|from rdb$database
|-- returns 80: ü and ß take up two bytes each in UTF8
||
select bit_length
|(cast (_iso8859_1 'Grüß di!' as char(24) character set utf8))
|from rdb$database
|-- returns 208: all 24 CHAR positions count, and two of them are 16-bit
See alsoSection 8.3.9, “OCTET_LENGTH()
”, Section 8.3.4, “CHAR_LENGTH()
, CHARACTER_LENGTH()
”
8.3.4. CHAR_LENGTH()
, CHARACTER_LENGTH()
Available inDSQL, PSQL
Result typeINTEGER
Syntax
|
CHAR_LENGTH (string)
|| CHARACTER_LENGTH (string)
CHAR[ACTER]_LENGTH
Function ParameterParameter | Description |
---|---|
string | An expression of a string type |
Gives the length in characters of the input string.
With arguments of type
CHAR
, this function returns the formal string length (i.e. the declared length of a field or variable). If you want to obtain thelogical
length, not counting the trailing spaces, right-TRIM
the argument before passing it toCHAR[ACTER]_LENGTH
.BLOB
support: Since Firebird 2.1, this function fully supports textBLOB
s of any length and character set.
8.3.4.1. CHAR_LENGTH
Examples
|select char_length('Hello!') from rdb$database
|-- returns 6
||
select char_length(_iso8859_1 'Grüß di!') from rdb$database
|-- returns 8
||
select char_length
|(cast (_iso8859_1 'Grüß di!' as varchar(24) character set utf8))
|from rdb$database
|-- returns 8; the fact that ü and ß take up two bytes each is irrelevant
||
select char_length
|(cast (_iso8859_1 'Grüß di!' as char(24) character set utf8))
|from rdb$database
|-- returns 24: all 24 CHAR positions count
See alsoSection 8.3.3, “BIT_LENGTH()
”, Section 8.3.9, “OCTET_LENGTH()
”
8.3.5. HASH()
Available inDSQL, PSQL
Result typeBIGINT
Syntax
|
HASH (string)
HASH
Function ParameterParameter | Description |
---|---|
string | An expression of a string type |
Returns a hash value for the input string.
This function fully supports text BLOB
s of any length and character set.
8.3.6. LEFT()
Available inDSQL, PSQL
Result typeVARCHAR
or BLOB
Syntax
|
LEFT (string, length)
LEFT
Function ParametersParameter | Description |
---|---|
string | An expression of a string type |
length | Integer expression. Defines the number of characters to return |
Returns the leftmost part of the argument string. The number of characters is given in the second argument.
This function fully supports text
BLOB
s of any length, including those with a multi-byte character set.If string is a
BLOB
, the result is aBLOB
. Otherwise, the result is aVARCHAR(n)
with n the length of the input string.If the length argument exceeds the string length, the input string is returned unchanged.
If the length argument is not a whole number, bankers' rounding (round-to-even) is applied, i.e. 0.5 becomes 0, 1.5 becomes 2, 2.5 becomes 2, 3.5 becomes 4, etc.
See alsoSection 8.3.14, “RIGHT()
”
8.3.7. LOWER()
Available inDSQL, ESQL, PSQL
Possible name conflictYES → Read details below
Result type(VAR)CHAR
or BLOB
Syntax
|
LOWER (string)
LOWER
Function ParameterSParameter | Description |
---|---|
string | An expression of a string type |
Returns the lower-case equivalent of the input string.
The exact result depends on the character set.
With ASCII
or NONE
for instance, only ASCII characters are lowercased;
with OCTETS
, the entire string is returned unchanged.
Since Firebird 2.1 this function also fully supports text BLOB
s of any length and character set.
Because LOWER
is a reserved word, the internal function will take precedence even if the external function by that name has also been declared.
To call the (inferior!) external function, use double-quotes and the exact capitalisation, as in "LOWER"(string)
.
8.3.7.1. LOWER
Examples
|select Sheriff from Towns
|where lower(Name) = 'cooper''s valley'
See alsoSection 8.3.18, “UPPER()
”
8.3.8. LPAD()
Available inDSQL, PSQL
Possible name conflictYES → Read details
Result typeVARCHAR
or BLOB
Syntax
|
LPAD (str, endlen [, padstr])
LPAD
Function ParametersParameter | Description |
---|---|
str | An expression of a string type |
endlen | Output string length |
padstr | The character or string to be used to pad the source string up to the specified length.
Default is space ( |
Left-pads a string with spaces or with a user-supplied string until a given length is reached.
This function fully supports text
BLOB
s of any length and character set.If str is a
BLOB
, the result is aBLOB
. Otherwise, the result is aVARCHAR(endlen)
.If padstr is given and equals
''
(empty string), no padding takes place.If endlen is less than the current string length, the string is truncated to endlen, even if padstr is the empty string.
In Firebird 2.1-2.1.3, all non-BLOB
results were of type VARCHAR(32765)
, which made it advisable to cast them to a more modest size.
This is no longer the case.
When used on a BLOB
, this function may need to load the entire object into memory.
Although it does try to limit memory consumption, this may affect performance if huge BLOB
s are involved.
8.3.8.1. LPAD
Examples
|lpad ('Hello', 12) -- returns ' Hello'
|lpad ('Hello', 12, '-') -- returns '-------Hello'
|lpad ('Hello', 12, '') -- returns 'Hello'
|lpad ('Hello', 12, 'abc') -- returns 'abcabcaHello'
|lpad ('Hello', 12, 'abcdefghij') -- returns 'abcdefgHello'
|lpad ('Hello', 2) -- returns 'He'
|lpad ('Hello', 2, '-') -- returns 'He'
|lpad ('Hello', 2, '') -- returns 'He'
See alsoSection 8.3.15, “RPAD()
”
8.3.9. OCTET_LENGTH()
Available inDSQL, PSQL
Result typeINTEGER
Syntax
|
OCTET_LENGTH (string)
OCTET_LENGTH
Function ParameterParameter | Description |
---|---|
string | An expression of a string type |
Gives the length in bytes (octets) of the input string.
For multi-byte character sets, this may be less than the number of characters times the formal
number of bytes per character as found in RDB$CHARACTER_SETS
.
With arguments of type CHAR
, this function takes the entire formal string length (i.e. the declared length of a field or variable) into account.
If you want to obtain the logical
byte length, not counting the trailing spaces, right-TRIM
the argument before passing it to OCTET_LENGTH
.
BLOB
supportSince Firebird 2.1, this function fully supports text BLOB
s of any length and character set.
8.3.9.1. OCTET_LENGTH
Examples
|select octet_length('Hello!') from rdb$database
|-- returns 6
||
select octet_length(_iso8859_1 'Grüß di!') from rdb$database
|-- returns 8: ü and ß take up one byte each in ISO8859_1
||
select octet_length
|(cast (_iso8859_1 'Grüß di!' as varchar(24) character set utf8))
|from rdb$database
|-- returns 10: ü and ß take up two bytes each in UTF8
||
select octet_length
|(cast (_iso8859_1 'Grüß di!' as char(24) character set utf8))
|from rdb$database
|-- returns 26: all 24 CHAR positions count, and two of them are 2-byte
See alsoSection 8.3.3, “BIT_LENGTH()
”, Section 8.3.4, “CHAR_LENGTH()
, CHARACTER_LENGTH()
”
8.3.10. OVERLAY()
Available inDSQL, PSQL
Result typeVARCHAR
or BLOB
Syntax
|
OVERLAY (string PLACING replacement FROM pos [FOR length])
OVERLAY
Function ParametersParameter | Description |
---|---|
string | The string into which the replacement takes place |
replacement | Replacement string |
pos | The position from which replacement takes place (starting position) |
length | The number of characters that are to be overwritten |
OVERLAY()
overwrites part of a string with another string.
By default, the number of characters removed from (overwritten in) the host string equals the length of the replacement string.
With the optional fourth argument, a different number of characters can be specified for removal.
This function supports
BLOB
s of any length.If string or replacement is a
BLOB
, the result is aBLOB
. Otherwise, the result is aVARCHAR(n)
with n the sum of the lengths of string and replacement.As usual in SQL string functions, pos is 1-based.
If pos is beyond the end of string, replacement is placed directly after string.
If the number of characters from pos to the end of string is smaller than the length of replacement (or than the length argument, if present), string is truncated at pos and replacement placed after it.
The effect of a
clause is that replacement is simply inserted into string.FOR 0
If any argument is
NULL
, the result isNULL
.If pos or length is not a whole number, bankers' rounding (round-to-even) is applied, i.e. 0.5 becomes 0, 1.5 becomes 2, 2.5 becomes 2, 3.5 becomes 4, etc.
When used on a BLOB
, this function may need to load the entire object into memory.
This may affect performance if huge BLOB
s are involved.
8.3.10.1. OVERLAY
Examples
|overlay ('Goodbye' placing 'Hello' from 2) -- returns 'GHelloe'
|overlay ('Goodbye' placing 'Hello' from 5) -- returns 'GoodHello'
|overlay ('Goodbye' placing 'Hello' from 8) -- returns 'GoodbyeHello'
|overlay ('Goodbye' placing 'Hello' from 20) -- returns 'GoodbyeHello'
||
overlay ('Goodbye' placing 'Hello' from 2 for 0) -- r. 'GHellooodbye'
|overlay ('Goodbye' placing 'Hello' from 2 for 3) -- r. 'GHellobye'
|overlay ('Goodbye' placing 'Hello' from 2 for 6) -- r. 'GHello'
|overlay ('Goodbye' placing 'Hello' from 2 for 9) -- r. 'GHello'
||
overlay ('Goodbye' placing '' from 4) -- returns 'Goodbye'
|overlay ('Goodbye' placing '' from 4 for 3) -- returns 'Gooe'
|overlay ('Goodbye' placing '' from 4 for 20) -- returns 'Goo'
||
overlay ('' placing 'Hello' from 4) -- returns 'Hello'
|overlay ('' placing 'Hello' from 4 for 0) -- returns 'Hello'
|overlay ('' placing 'Hello' from 4 for 20) -- returns 'Hello'
See alsoSection 8.3.12, “REPLACE()
”
8.3.11. POSITION()
Available inDSQL, PSQL
Result typeINTEGER
Syntax
|
POSITION (substr IN string)
|| POSITION (substr, string [, startpos])
POSITION
Function ParametersParameter | Description |
---|---|
substr | The substring whose position is to be searched for |
string | The string which is to be searched |
startpos | The position in string where the search is to start |
Returns the (1-based) position of the first occurrence of a substring in a host string. With the optional third argument, the search starts at a given offset, disregarding any matches that may occur earlier in the string. If no match is found, the result is 0.
The optional third argument is only supported in the second syntax (comma syntax).
The empty string is considered a substring of every string. Therefore, if substr is
''
(empty string) and string is notNULL
, the result is:1 if startpos is not given;
startpos if startpos lies within string;
0 if startpos lies beyond the end of string.
Notice: A bug in Firebird 2.1 - 2.1.3 and 2.5.0 causes
POSITION
to always return 1 if substr is the empty string. This is fixed in 2.1.4 and 2.5.1.This function fully supports text
BLOB
s of any size and character set.
When used on a BLOB
, this function may need to load the entire object into memory.
This may affect performance if huge BLOB
s are involved.
8.3.11.1. POSITION
Examples
|position ('be' in 'To be or not to be') -- returns 4
|position ('be', 'To be or not to be') -- returns 4
|position ('be', 'To be or not to be', 4) -- returns 4
|position ('be', 'To be or not to be', 8) -- returns 17
|position ('be', 'To be or not to be', 18) -- returns 0
|position ('be' in 'Alas, poor Yorick!') -- returns 0
See alsoSection 8.3.16, “SUBSTRING()
”
8.3.12. REPLACE()
Available inDSQL, PSQL
Result typeVARCHAR
or BLOB
Syntax
|
REPLACE (str, find, repl)
REPLACE
Function ParametersParameter | Description |
---|---|
str | The string in which the replacement is to take place |
find | The string to search for |
repl | The replacement string |
Replaces all occurrences of a substring in a string.
This function fully supports text
BLOB
s of any length and character set.If any argument is a
BLOB
, the result is aBLOB
. Otherwise, the result is aVARCHAR(n)
with n calculated from the lengths of str, find and repl in such a way that even the maximum possible number of replacements won’t overflow the field.If find is the empty string, str is returned unchanged.
If repl is the empty string, all occurrences of find are deleted from str.
If any argument is
NULL
, the result is alwaysNULL
, even if nothing would have been replaced.
When used on a BLOB
, this function may need to load the entire object into memory.
This may affect performance if huge BLOB
s are involved.
8.3.12.1. REPLACE
Examples
|replace ('Billy Wilder', 'il', 'oog') -- returns 'Boogly Woogder'
|replace ('Billy Wilder', 'il', '') -- returns 'Bly Wder'
|replace ('Billy Wilder', null, 'oog') -- returns NULL
|replace ('Billy Wilder', 'il', null) -- returns NULL
|replace ('Billy Wilder', 'xyz', null) -- returns NULL (!)
|replace ('Billy Wilder', 'xyz', 'abc') -- returns 'Billy Wilder'
|replace ('Billy Wilder', '', 'abc') -- returns 'Billy Wilder'
See alsoSection 8.3.10, “OVERLAY()
”, Section 8.3.16, “SUBSTRING()
”, Section 8.3.11, “POSITION()
”, Section 8.3.4, “CHAR_LENGTH()
, CHARACTER_LENGTH()
”
8.3.13. REVERSE()
Available inDSQL, PSQL
Result typeVARCHAR
Syntax
|
REVERSE (string)
REVERSE
Function ParameterParameter | Description |
---|---|
string | An expression of a string type |
Returns a string backwards.
8.3.13.1. REVERSE
Examples
|reverse ('spoonful') -- returns 'lufnoops'
|reverse ('Was it a cat I saw?') -- returns '?was I tac a ti saW'
This function comes in very handy if you want to group, search or order on string endings, e.g. when dealing with domain names or email addresses:
|create index ix_people_email on people
|computed by (reverse(email));
||
select * from people
|where reverse(email) starting with reverse('.br');
8.3.14. RIGHT()
Available inDSQL, PSQL
Possible name conflictYES → Read details
Result typeVARCHAR
or BLOB
Syntax
|
RIGHT (string, length)
RIGHT
Function ParametersParameter | Description |
---|---|
string | An expression of a string type |
length | Integer. Defines the number of characters to return |
Returns the rightmost part of the argument string. The number of characters is given in the second argument.
This function supports text
BLOB
s of any length, but has a bug in versions 2.1 - 2.1.3 and 2.5.0 that makes it fail with textBLOB
s larger than 1024 bytes that have a multi-byte character set. This has been fixed in versions 2.1.4 and 2.5.1.If string is a
BLOB
, the result is aBLOB
. Otherwise, the result is aVARCHAR(n)
with n the length of the input string.If the length argument exceeds the string length, the input string is returned unchanged.
If the length argument is not a whole number, bankers' rounding (round-to-even) is applied, i.e. 0.5 becomes 0, 1.5 becomes 2, 2.5 becomes 2, 3.5 becomes 4, etc.
When used on a BLOB
, this function may need to load the entire object into memory.
This may affect performance if huge BLOB
s are involved.
See alsoSection 8.3.6, “LEFT()
”, Section 8.3.16, “SUBSTRING()
”
8.3.15. RPAD()
Available inDSQL, PSQL
Possible name conflictYES → Read details
Result typeVARCHAR
or BLOB
Syntax
|
RPAD (str, endlen [, padstr])
RPAD
Function ParametersParameter | Description |
---|---|
str | An expression of a string type |
endlen | Output string length |
endlen | The character or string to be used to pad the source string up to the specified length.
Default is space ( |
Right-pads a string with spaces or with a user-supplied string until a given length is reached.
This function fully supports text
BLOB
s of any length and character set.If str is a
BLOB
, the result is aBLOB
. Otherwise, the result is aVARCHAR(endlen)
.If padstr is given and equals
''
(empty string), no padding takes place.If endlen is less than the current string length, the string is truncated to endlen, even if padstr is the empty string.
In Firebird 2.1-2.1.3, all non-BLOB
results were of type VARCHAR(32765)
, which made it advisable to cast them to a more modest size.
This is no longer the case.
When used on a BLOB
, this function may need to load the entire object into memory.
Although it does try to limit memory consumption, this may affect performance if huge BLOB
s are involved.
8.3.15.1. RPAD
Examples
|rpad ('Hello', 12) -- returns 'Hello '
|rpad ('Hello', 12, '-') -- returns 'Hello-------'
|rpad ('Hello', 12, '') -- returns 'Hello'
|rpad ('Hello', 12, 'abc') -- returns 'Helloabcabca'
|rpad ('Hello', 12, 'abcdefghij') -- returns 'Helloabcdefg'
|rpad ('Hello', 2) -- returns 'He'
|rpad ('Hello', 2, '-') -- returns 'He'
|rpad ('Hello', 2, '') -- returns 'He'
See alsoSection 8.3.8, “LPAD()
”
8.3.16. SUBSTRING()
Available inDSQL, PSQL
Result typesVARCHAR
or BLOB
Syntax
|
SUBSTRING ( <substring-args> )
|
|<substring-args> ::=
| str FROM startpos [FOR length]
| | str SIMILAR <similar-pattern> ESCAPE <escape>
|
|<similar-pattern> ::=
| <similar-pattern-R1>
| <escape> " <similar-pattern-R2> <escape> "
| <similar-pattern-R3>
SUBSTRING
Function ParametersParameter | Description |
---|---|
str | An expression of a string type |
startpos | Integer expression, the position from which to start retrieving the substring |
length | The number of characters to retrieve after the startpos |
similar-pattern | SQL regular expression pattern to search for the substring |
escape | Escape character |
Returns a string’s substring starting at the given position, either to the end of the string or with a given length, or extracts a substring using an SQL regular expression pattern.
If any argument is NULL
, the result is also NULL
.
When used on a BLOB
, this function may need to load the entire object into memory.
Although it does try to limit memory consumption, this may affect performance if huge BLOB
s are involved.
8.3.16.1. Positional SUBSTRING
In its simple, positional form (with FROM
), this function returns the substring starting at character position startpos (the first position being 1).
Without the FOR
argument, it returns all the remaining characters in the string.
With FOR
, it returns length characters or the remainder of the string, whichever is shorter.
The function fully supports binary and text BLOB
s of any length, and with any character set.
If str is a BLOB
, the result is also a BLOB
.
For any other argument type, the result is a VARCHAR
.
For non-BLOB
arguments, the width of the result field is always equal to the length of str, regardless of startpos and length.
So, substring('pinhead' from 4 for 2)
will return a VARCHAR(7)
containing the string 'he'
.
Example
|
insert into AbbrNames(AbbrName)
| select substring(LongName from 1 for 3) from LongNames
8.3.16.2. Regular Expression SUBSTRING
In the regular expression form (with SIMILAR
), the SUBSTRING
function returns part of the string matching an SQL regular expression pattern.
If no match is found, NULL
is returned.
The SIMILAR
pattern is formed from three SQL regular expression patterns, R1, R2 and R3.
The entire pattern takes the form of R1 || '<escape>"' || R2 || '<escape>"' || R3
, where <escape> is the escape character defined in the ESCAPE
clause.
R2 is the pattern that matches the substring to extract, and is enclosed between escaped double quotes (<escape>"
, e.g.
with escape character #"
).
R1 matches the prefix of the string, and R3 the suffix of the string.
Both R1 and R3 are optional (they can be empty), but the pattern must match the entire string.
In other words, it is not sufficient to specify a pattern that only finds the substring to extract.#
The escaped double quotes around R2 can be compared to defining a single capture group in more common regular expression syntax like PCRE.
That is, the full pattern is equivalent to R1(R2)R3
, which must match the entire input string, and the capture group is the substring to be returned.
If any one of R1, R2, or R3 is not a zero-length string and does not have the format of an SQL regular expression, then an exception is raised.
The full SQL regular expression format is described in Syntax: SQL Regular Expressions
Examples
|
substring('abcabc' similar 'a#"bcab#"c' escape '#') -- bcab
|substring('abcabc' similar 'a#"%#"c' escape '#') -- bcab
|substring('abcabc' similar '_#"%#"_' escape '#') -- bcab
|substring('abcabc' similar '#"(abc)*#"' escape '#') -- abcabc
|substring('abcabc' similar '#"abc#"' escape '#') -- <null>
See alsoSection 8.3.11, “POSITION()
”, Section 8.3.6, “LEFT()
”, Section 8.3.14, “RIGHT()
”, Section 8.3.4, “CHAR_LENGTH()
, CHARACTER_LENGTH()
”, SIMILAR TO
8.3.17. TRIM()
Available inDSQL, PSQL
Result typeVARCHAR
or BLOB
Syntax
|
TRIM ([<adjust>] str)
|
|<adjust> ::= {[<where>] [what]} FROM
|
|<where> ::= BOTH | LEADING | TRAILING
TRIM
Function ParametersParameter | Description |
---|---|
str | An expression of a string type |
where | The position the substring is to be removed from — |
what | The substring that should be removed (multiple times if there are several matches) from the beginning, the end, or both sides of the input string str.
By default it is space ( |
Removes leading and/or trailing spaces (or optionally other strings) from the input string.
Since Firebird 2.1 this function fully supports text BLOB
s of any length and character set.
If str is a
BLOB
, the result is aBLOB
. Otherwise, it is aVARCHAR(n)
with n the formal length of str.Since Firebird 3.0, the maximum size of what — if a `BLOB — was increased to 4GB, in previous versions the value of what could not exceed 32767 bytes.
When used on a BLOB
, this function may need to load the entire object into memory.
This may affect performance if huge BLOB
s are involved.
8.3.17.1. TRIM
Examples
|select trim (' Waste no space ') from rdb$database
|-- returns 'Waste no space'
||
select trim (leading from ' Waste no space ') from rdb$database
|-- returns 'Waste no space '
||
select trim (leading '.' from ' Waste no space ') from rdb$database
|-- returns ' Waste no space '
||
select trim (trailing '!' from 'Help!!!!') from rdb$database
|-- returns 'Help'
||
select trim ('la' from 'lalala I love you Ella') from rdb$database
|-- returns ' I love you El'
||
select trim ('la' from 'Lalala I love you Ella') from rdb$database
|-- returns 'Lalala I love you El'
8.3.18. UPPER()
Available inDSQL, ESQL, PSQL
Result type(VAR)CHAR
or BLOB
Syntax
|
UPPER (str)
UPPER
Function ParameterParameter | Description |
---|---|
str | An expression of a string type |
Returns the upper-case equivalent of the input string.
The exact result depends on the character set.
With ASCII
or NONE
for instance, only ASCII characters are uppercased;
with OCTETS
, the entire string is returned unchanged.
Since Firebird 2.1 this function also fully supports text BLOB
s of any length and character set.
8.3.18.1. UPPER
Examples
|select upper(_iso8859_1 'Débâcle')
|from rdb$database
|-- returns 'DÉBÂCLE' (before Firebird 2.0: 'DéBâCLE')
||
select upper(_iso8859_1 'Débâcle' collate fr_fr)
|from rdb$database
|-- returns 'DEBACLE', following French uppercasing rules
See alsoSection 8.3.7, “LOWER()
”