UPPER (SQL)
Synopsis
UPPER(expression)
UPPER expression
Description
The UPPER function converts all alphabetic characters to uppercase letters. This is the inverse of the LOWER function. UPPER does not change numbers, punctuation, and leading or trailing blank spaces.
UPPER does not force a numeric to be interpreted as a string. InterSystems SQL removes leading and trailing zeros from numerics. A numeric specified as a string retains leading and trailing zeros.
This function can also be invoked from ObjectScript using the UPPER()Opens in a new tab method call:
$SYSTEM.SQL.Functions.UPPER(expression)
UPPER is a standard function for alphabetic case conversion, not for collation. For uppercase collation use %SQLUPPER, which provides superior collation of numerics, NULL values and empty strings.
Arguments
expression
A string expression, which can be the name of a column, a string literal, or the result of another function, where the underlying data type can be represented as any character type (such as CHAR or VARCHAR).
Examples
The following example returns all names, selecting those where the uppercase form of the name starts with “JO”:
SELECT Name
FROM Sample.Person
WHERE UPPER(Name) %STARTSWITH UPPER('JO')
The following example returns all names in uppercase, selecting those where the name starts with “JO”:
SELECT UPPER(Name) AS CapName
FROM Sample.Person
WHERE Name %STARTSWITH UPPER('JO')
The following example converts the lowercase Greek letter Delta to uppercase. This example uses the UPPER syntax that uses a space, rather than parentheses, to separate keyword from argument:
SELECT UPPER {fn CHAR(948)},{fn CHAR(948)}
FROM Sample.Person
See Also
-
%SQLUPPER collation function
-
%STARTSWITH predicate condition
-
LOWER function
-
UCASE function