Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Using Generic Comparator in Oracle ORDER BY
Hans,
I know I can write a function that converts my column to something that can be ordered lexicographically (and can thus be sorted with ORDER BY) - I've known that from post1. The problem is no such function could handle an input of arbitrary depth. What I was looking for was a tool that allows me to tell Oracle, "hey, order by column X, but instead of using the standard lexicographic or numeric ordering, use my custom comparison function F".
To put it another way:
In your second example, your function maps from (e.partno) to a string <description>, which must be lexicographically ordered.
The fact is, with Oracle's ORDER BY, I must convert C1 values into strings and the order by those strings lexicographically (or convert C1 into numbers and order those numerically). That's not what I want.
In my desired solution, F would take any two arguments from C1, and tell Oracle which of them is less than the other. Oracle would then use the function F to sort C1 directly... using no LEXICOGRAPHIC or NUMERIC comparisons whatsoever.
![]() |
![]() |