Ignore trailing whitespaces in comparisons using collation in Oracle 12c

244 Views Asked by At

I want to have the Oracle database regard 'abc' and 'abc ' VARCHAR2s as being equal in all comparisons (WHERE-clauses, sorting, ...). Basically this means ignoring the trailing whitespaces like the PADSPACE collations do in MariaDB/MySQL.

There are solutions available like using the RTRIM function, but I am specifically looking at a solution using collation because I need something that is transparent and does not have a huge impact on performance (ie. applying RTRIM on the left side of my equation). I do seem to remember that at some point in the past on an older Oracle installation I managed to achieve this behaviour by just selecting the right collation (ie. setting NLS_COMP to linguistic, and then some value for NLS_SORT). Now a few years later and with a newer Oracle installation (12c) I cannot seem to replicate the same behaviour anymore. It is just a memory though, so I could be mixing it up with a usecase in MySQL rather than an 'older Oracle'.

Is there any collation in Oracle12c that ignores trailing whitespaces in comparisons (ie. an equivalent to the PADSPACE collations in MySQL/MariaDB)? I have tried multiple collations already (BINARY_AI, FRENCH, XFRENCH, FRENCH_M, UCA0610_DUCET and UCA0620_DUCET) to no avail.

Thanks in advance!

0

There are 0 best solutions below