cancel
Showing results for 
Search instead for 
Did you mean: 

Select query case insensitive for data type VARG

chinna_babu2
Active Participant
0 Kudos

Hi Experts,

I am having trouble in retrieving the results from a table using select query.

I have a table (Users) as below

Name (VARG) Number(INTEGER)

-


Murthy 0001

murthy 0002

-


when I am querying the table with select query as -


select * from Users where Name = 'Murthy'

this query is returning only one record which matches with capital letter of 'M', though both the record names are same.

I have seen in IBM forum to make the select query as case insensitive using the UPPER key word, I have tried this as below -


select * from Users where UPPER(Name) = 'MURTHY'

But this query is not working in my case...

My DB2 version is 8.1.5

Can any one please help in fixing this problem...

Thanks in Advance,

Murthy

Accepted Solutions (0)

Answers (1)

Answers (1)

KayKa
Active Participant
0 Kudos

Hi Murthy,

your query is the right to one to select both records. I don't see why it doesn't work.

Are you sure you posted the query that you have executed ?

What is the result of this query ?

But i don't really know how an VARG (Varying-length graphic string) will work. It could be that the UPPER-Function will work in another way as it works on VARCHAR.

regards

Kay

KayKa
Active Participant
0 Kudos

Hi Murthy,

please try this query and post the result:

select name, '-' || UPPER(Name) || '-' from Users where Name in ( 'Murthy', 'murthy' );

just to see how the UPPER works.

regards

Kay

chinna_babu2
Active Participant
0 Kudos

Resolved the issue, by adding new column which holds the upper case values and querying the table by putting upper case value in where condition.\