Skip to Main Content

Info

Sorting on varchar2 columns containing data that are almost numbers (but not quite) is a problem.

In the example below, all the 10.x "numbers" should come after the 2.x numbers, and 10.1 should come after 10.2. Sorting it "as a number" fixes the first but not the second issue.
The "A Lpad" column does fix both, but it's not very elegant of course. And ideally you don't want to show that column to the user, and only use it to sort the data "in the background" without the user ever seeing it.
I have played around with this, but haven't found a nice solution yet.
The "HTML Expression" column option seemed like the best bet, but that also falls short. If you want to use that, you cannot make "A Lpad" a hidden column, which means the user still sees it.
And Exporting the report (e.g. to CSV) with the correct sort order, but without the "A Lpad" column, also seems impossible.
So if this is possible, I still have to find out how...

IR

A Varchar2A NumberA Lpad
1.11.1 1.01
1.21.2 1.02
10.110.110.01
10.1110.1110.11
10.210.210.02
2.12.1 2.01
2.22.2 2.02

Code

Page

Identification
Page ID
Name

Region

Identification
Sequence
Title
Type
Source
Source Type
Table Name

View

View
Name
DDL