Search code examples
abapopensql

Case-insensitive comparison in SELECT condition


In ABAP SQL can I ignore the case when comparing fields in the WHERE clause of a SELECT?

SELECT * 
FROM some_table 
WHERE field1 = variable1.

How can I compare field1 to variable1 ignoring different case?


Solution

  • Depending on the table you are selecting from, you may be lucky in that SAP is storing the same value in a related matchcode field, in which the value would always be upper case.

    Otherwise, you may find something in the documentation of the underlying DB that allows such a search, in which case you may issue a native SELECT.

    For example, if your SAP system uses Oracle as the underlying DB, you can refer to this article: http://www.dba-oracle.com/oracle_news/2005_5_20_great_technique_case_sensitive_text_searching.htm