Skip to main content

UCASE (SQL)

A case-transformation function that converts all lowercase letters in a string to uppercase letters.

Synopsis

UCASE(string-expression)

{fn UCASE(string-expression)}

Description

UCASE converts lowercase letters to uppercase for display purposes. It has no effects on non-alphabetic characters; it leaves numbers, punctuation, and leading or trailing blank spaces unchanged.

Note that UCASE can be used as an ODBC scalar function (with the curly brace syntax) or as an SQL general function.

UCASE 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.

UCASE does not affect collation. The %SQLUPPER function is the preferred way in SQL to convert a data value for not case-sensitive collation. Refer to %SQLUPPER for further information on case transformation for collation.

This function can also be invoked from ObjectScript using the UPPER()Opens in a new tab method call:

$SYSTEM.SQL.UPPER(expression)

Arguments

string-expression

The string whose characters are to be converted to uppercase. The expression can be the name of a column, a string literal, or the result of another scalar function, where the underlying data type can be represented as any character type (such as CHAR or VARCHAR).

Examples

The following example returns each person’s name in uppercase letters:

SELECT Name,{fn UCASE(Name)} AS CapName
     FROM Sample.Person

UCASE also works on Unicode (non-ASCII) alphabetic characters, as shown in the following example, which converts Greek letters from lowercase to uppercase:

SELECT UCASE($CHAR(950,949,965,963))

See Also

FeedbackOpens in a new tab