CHECK WHETHER VALUES ARE UPPERCASE OR NOT IN DATABASE

Today, i will discuss about how to check which values in the table for a particular column are uppercase or not.

I have designed a Query using dual to achieve the same. Below is the Query.

select * from
(select ‘A’ as col1, ‘B’ as col2 from dual
union
select ‘a’ col1,’D’ as col2 from dual) A,
(select ‘A’ as col1 ,’B’ as col2 from dual
union
select ‘a’ col1 ,’D’ as col2 from dual)B
where upper(B.col1)=A.col1
and B.col2=A.col2;

I created table A and table B using dual command . In each table, there are two records. If you see clearly , both tables have same set of rows. When you join these tables using inner join, it becomes a self join.

So, in order to identify the rows where value in a column is uppercase or not, you need to write a Query using self join.

Secondly, in where clause, keep condition upper(B.col1)=A.col1  and you should  know the remaining joining conditions in order to one to one map in self join. This will give us rows which are in upper case. See the below SS for the same.

Here col1  in your case  is the column on which you want to check the UPPERCASE logic.

 

Related posts