If I run this query :
select distinct column_value as test
from table(sys.dbms_debug_vc2coll('AFGHANISTAN','*AFRIQUE','(AUCUN)','ITALIE','**MONDE'))
order by test asc;
I would expect either :
(AUCUN)
**MONDE
*AFRIQUE
AFGHANISTAN
ITALIE
Or
AFGHANISTAN
ITALIE
*AFRIQUE
**MONDE
(AUCUN)
But this what I get :
AFGHANISTAN
*AFRIQUE
(AUCUN)
ITALIE
**MONDE
So it looks as it's ignoring (
and *
completely.
If I change my session NLS_SORT param from FRENCH to BINARY
alter session set NLS_SORT=BINARY;
The order is fine.
But I'm not really supposed to alter my customer database settings, is there some reason for getting this weird order by default?
And can I do anything through JPA criteria API to get the good order without altering the database?
EDIT : This is the Expression to use for order :
// My Original field expression used for the sort
Expression<String> myFieldExp = root.get("mySortField");
Expression<String> sortExpWithNLSfix = builder.function("nlssort", String.class, myFieldExp , builder.literal("nls_sort=binary"));
myCritQuery.orderBy(builder.asc(sortExpWithNLSfix);