how Upper() and Lower() functions work in Teradata

Database
Enthusiast

how Upper() and Lower() functions work in Teradata

Hi,

I met a situation where I need to compare the lower case alphabets with upper case. But in teradata lower and upper functions are unable to do that.

here is the example:

sel case when upper('AbC')=lower('AbC') then 1 else 0 end as flag, upper('AbC'),lower('AbC');

  When I am comparing the string using lower and upper() function , TD is treating them equal and when I am printing them , Alphabets are being chaged.







  flag Upper('AbC') Lower('AbC')
1 1 ABC abc

Please helpme on this..!

Thanks in advance...

Tags (1)
2 REPLIES
Enthusiast

Re: how Upper() and Lower() functions work in Teradata

Hi,

By default Teradata is not case sensitive, so it will treat Abc = ABC, While in you statement you are explicitly converting one string to upper and one string to lower, you should cast them to the same case, In order to perform case sensitive comparison you can add CASESENSTIVE in fron of string like below:

sel case when upper('AbC') (CASESPECIFIC) = lower('AbC')  (CASESPECIFIC) then 1 else 0 end as flag, upper('AbC'),lower('AbC'); 
Khurram
Enthusiast

Re: how Upper() and Lower() functions work in Teradata

 Thaks Khurram !!