Learn how to use the Oracle/PLSQL UPPER function with syntax and examples.
The Oracle/PLSQL UPPER function converts all letters in the specified string to uppercase. If there are characters in the string that are not letters, they are unaffected by this function.
The syntax for the Oracle/PLSQL UPPER function is:
UPPER( string1 )
string1 is the string to convert to uppercase.
The UPPER function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle UPPER function examples and explore how to use the UPPER function in Oracle/PLSQL.
UPPER('Tech on the Net') Result: 'TECH ON THE NET' UPPER('george burns 123 ') Result: 'GEORGE BURNS 123 '
Question: How do you incorporate the Oracle UPPER function with the LIKE condition? I'm trying to query against a free text field for all records containing the word "test". The problem is that it can be entered in the following ways: TEST, Test, or test.
Answer: To answer this question, let's look at an example.
Let's say that we have a suppliers table with a field called supplier_name that contains the values TEST, Test, or test.
If we wanted to find all records containing the word "test", regardless of whether it was stored as TEST, Test, or test, we could run either of the following SQL statements:
select * from suppliers where UPPER(supplier_name) like ('TEST%');
select * from suppliers where UPPER(supplier_name) like UPPER('test%')
These SQL statements use a combination of the UPPER function and the LIKE condition to return all of the records where the supplier_name field contains the word "test", regardless of whether it was stored as TEST, Test, or test.