I have a list of records in PostgreSQL as follows, these are actually sections of various books The records are generated in the below format.
1
7.1
6.2
7.1
7.4
6.8.3
6.8.2
10
1.1
7.6
6.1
11
8.3
8.5
1.1.2
6.4
6.6
8.4
1.1.6
6.8.1
7.7.1
7.5
7.3
I want to sort it like this
1
1.1
1.1.2
1.1.6
6.2
6.4
6.5
6.6
6.7
6.8.1
6.8.2
6.8.3
7.2
7.3
7.4
7.5
7.6
7.7.1
7.7.2
8.3
8.4
8.5
10
It's a varchar column so i have tried using what listed here. Sorting records from Oracle with multiple decimal points (.)
select * from tbl_wo_kitting where wo_project_id = 1000033
ORDER BY to_number(regexp_substr(line_no, '[^.]+', 1, 1)) NULLS FIRST
It keeps saying invalid function name regexp_substr. What are the functions to sort that way?
Thank you very much for your help.