docs.intersystems.com
Home  /  Application Development: Core Topics  /  InterSystems SQL Reference  /  SQL Functions  /  %UPPER


InterSystems SQL Reference
%UPPER
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


Deprecated. A collation function that converts alphabetic characters to the UPPER collation format.
Synopsis
%UPPER(expression)
%UPPER expression
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 VARCHAR2).
Description
This is a deprecated collation function. Please refer to %SQLUPPER for new development. %SQLUPPER provides superior collation of numerics, NULL values and empty strings.
%UPPER converts all alphabetic characters to uppercase (i.e., the UPPER format). It leaves unchanged numbers, punctuation, and leading and 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.
%UPPER is an InterSystems SQL extension and is intended for SQL lookup queries.
You can perform the same collation conversion in ObjectScript using the Collation() method of the %SYSTEM.Util class:
  WRITE $SYSTEM.Util.Collation("The quick, BROWN fox.",5)
This function can also be invoked from ObjectScript using the UPPER() method call:
  WRITE $SYSTEM.SQL.UPPER("The quick, BROWN fox.")
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 'Jo'
The following Embedded SQL 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:
    &sql(SELECT %UPPER {fn CHAR(948)},{fn CHAR(948)}
    INTO :a,:b
    FROM Sample.Person)
    IF SQLCODE'=0 {WRITE !,"Error code ",SQLCODE }
    ELSE {WRITE !,a,!,b }
See Also