Skip to main content

UCASE

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

Synopsis

UCASE(string-expression)
{fn UCASE(string-expression)}

Arguments

Argument Description
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).

Description

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

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. Caché 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)

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 Embedded SQL example, which converts Greek letters from lowercase to uppercase:

  IF $SYSTEM.Version.IsUnicode() {
    SET a=$CHAR(950,949,965,963)
    &sql(SELECT UCASE(:a)
    INTO :b
    FROM Sample.Person)
    IF SQLCODE'=0 {WRITE !,"Error code ",SQLCODE }
    ELSE {WRITE !,a,!,b }
  }
  ELSE {WRITE "This example requires a Unicode installation of Caché"}

See Also

FeedbackOpens in a new tab