Oracle 19c SQL

  1. Home
  2. Docs
  3. Oracle 19c SQL
  4. Single Row Character Functions
  5. UPPER

UPPER

  • UPPER is a single row character function.
  • It converts character values to upper case.
  • The return value has the same data type as the argument CHAR type (CHAR or VARCHAR2).
  • Can take a number type as input but UPPER has no effect. Return type is VARCHAR2.

Syntax: UPPER(Character String)

SELECT
    'the code man' Name,
    UPPER('the code man') Upper_Name
  FROM DUAL;

NAME	     UPPER_NAME
------------ ------------
the code man THE CODE MAN
SELECT
    'The Code Man' Name,
    UPPER('The Code Man') Upper_Name
  FROM DUAL;

NAME	     UPPER_NAME
------------ ------------
The Code Man THE CODE MAN
SELECT
    'THe CoDE maN' Name,
    UPPER('THe CoDE maN') Upper_Name
  FROM DUAL;

NAME	     UPPER_NAME
------------ ------------
THe CoDE maN THE CODE MAN
SELECT
    'THE CODE MAN' Name,
    UPPER('THE CODE MAN') Upper_Name
  FROM DUAL;

NAME     UPPER_NAME
------------ ------------
THE CODE MAN THE CODE MAN
SELECT
    'TheCode1000' Name,
    UPPER('TheCode1000') Upper_Name
  FROM DUAL;

NAME	    UPPER_NAME
----------- -----------
TheCode1000 THECODE1000

UPPER function does not throw error when a non-character is supplied. Following example shows UPPER takes a NUMBER as input and returns a VARCHAR2.

SELECT
    12345.70990 Name,
    UPPER(12345.709905) Upper_Name
  FROM DUAL;

      NAME UPPER_NAME
---------- ------------
12345.7099 12345.709905

Let us see how does UPPER behaves with table rows.

SELECT Empno, Ename, UPPER(Ename) Ename_Caps 
  FROM Emp;

     EMPNO ENAME      ENAME_CAPS
---------- ---------- ----------
      7839 KING       KING
      7698 BLAKE      BLAKE
      7782 CLARK      CLARK
      7566 JONES      JONES
      7788 SCOTT      SCOTT
      7902 FORD       FORD
      7369 SMITH      SMITH
      7499 ALLEN      ALLEN
      7521 WARD       WARD
      7654 MARTIN     MARTIN
      7844 TURNER     TURNER
      7876 ADAMS      ADAMS
      7900 JAMES      JAMES
      7934 MILLER     MILLER

14 rows selected.
Was this article helpful to you? Yes No

How can we help?