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?
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?
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
You can't. Open SQL does not support case insensitive conditions.
You can either do what mydoghasworms suggested or you filter your results using regex after data selection.
OpenSQL can't do this - like the others mentioned alreay in earlier statements.
But there is one alternative: Native SQL, the "upper" function, means:
translate compare_value to upper case.
exec sql performing addX.
select * FROM INTO :workarea
where upper("choose_column") eq :compare_value
endexec.
form addX.
append workarea to itab.
endform.