I am trying to sort the below varchar field in oracle.
Source:
Not a Valid Version
Not a Valid Version
3.12p5s2
I will always have one value like '3.12p5s2' and other values with the text 'Not a Valid Version'. Text '3.12p5s2' can have different formats like '3.12s2' or '3.12d5'. I am trying to sort the data in such a way that 'Not a Valid Version' always comes last irrespective of the format in '3.12p5s2'.
Sample Output:
3.12p5s2
Not a Valid Version
Not a Valid Version
This is what I tried, this does give what I want but am not too sure if sorting ascending would work all the time.
select '3.12p5s2' as firmware from dual union all
select 'Not a Valid Version' as firmware from dual union all
select 'Not a Valid Version' as firmware from dual
order by firmware asc;
Any inputs will be valuable.
Thanks