0

My code is:

CURSOR get_party_description is      
      select party_name  
      from   ifsapp.IDENTITY_PAY_INFO_ALL
      where  party_type    = :NEW.PARTY_TYPE
      and    identity   = identity_

:NEW_PARTY_TYPE = 'SUPPLIER' while the value in the field is 'Supplier'. This code will pull back no records but if I change it to 'Supplier', it finds the record

How do I change to search with out matching the case?

Gurwinder Singh
  • 38,557
  • 6
  • 51
  • 76

3 Answers3

2

You can convert both the variable and the field to upper or lower case.

where  UPPER(party_type)    = UPPER(:NEW.PARTY_TYPE)

This might cause a table space scan as the index on the field would be Case sensitive.

you can get around this by adding a generated column that is upper case and indexing that.

DB2_Philip
  • 81
  • 3
0

Change both of your values to upper case. Example:

CURSOR get_party_description is      
      select party_name  
      from   ifsapp.IDENTITY_PAY_INFO_ALL
      where  UPPER(party_type)    = UPPER('SUPPLIER')
      and    identity   = identity_
NicoRiff
  • 4,803
  • 3
  • 25
  • 54
0

Besides converting both strings to the same case (upper- or lower-) and then comparing them for equality, most SQL dialects allow one to do a case-insensitive comparison by using the LIKE operator, as follows:

CURSOR get_party_description is      
    select party_name  
    from   ifsapp.IDENTITY_PAY_INFO_ALL
    where  party_type LIKE :NEW.PARTY_TYPE
    and    identity   = identity_
STLDev
  • 5,950
  • 25
  • 36