I tried this solution Order By Split Column but doesn't work when length of number are doesn't same
You can make them contain the same number of "." or tokens. For example, if you know that there can be a maximum of 4 dots (eg. 1.1.1.1.1) then you can run this script to concatenate the remaining ".0" tokens :
create table mytable(id varchar);
insert into mytable(id)
values ('1'), ('1.1'), ('1.2'), ('1.2.1'), ('1.2.2'), ('1.19.1.1'), ('1.2.3.1'), ('1.2.3.2'), ('1.19.1'), ('1.19.1.2');
select id as original, id||
case when length(id) - length(replace(id,'.','')) = 0 then ".0.0.0.0"
when length(id) - length(replace(id,'.','')) = 1 then ".0.0.0"
when length(id) - length(replace(id,'.','')) = 2 then ".0.0"
when length(id) - length(replace(id,'.','')) = 3 then ".0"
end as computed
from mytable;
You can run (each sql command at a time) the script here to test it
Result :
----------------------------
| original | computed |
----------------------------
| 1 | 1.0.0.0.0 |
| 1.1 | 1.1.0.0.0 |
| 1.2 | 1.2.0.0.0 |
| 1.2.1 | 1.2.1.0.0 |
| 1.2.2 | 1.2.2.0.0 |
| 1.19.1.1 | 1.19.1.1.0 |
| 1.2.3.1 | 1.2.3.1.0 |
| 1.2.3.2 | 1.2.3.2.0 |
| 1.19.1 | 1.19.1.0.0 |
| 1.19.1.2 | 1.19.1.2.0 |
----------------------------
After this conversion you can apply the script that you mentioned.