[TECHNICAL SUPPORT] LPS-47261 Avoiding use clob in SELECT DISTINCT + TESTS

Hi @migue,

This pull solves this:
https://issues.liferay.com/browse/LPS-47261

It includes JUnit Tests, if you execute them over Oracle 10G before my changes you will get 3 of 4 errors, all of them work after my modifications.

Thanks.