Currently I'm trying to take a list of values from my table and order them alphanumerically so they appear from number to letters. For example I have this data set
3
8
56
70
90
AK
CN
PP
PQ
W3
0.5
0.6
0.8
040
070
1.2
1.5
1.6
100
150
187
2.8
250
3.0
6.3
800
8mm
And I want it to print 0.5 first and then W3 last. I am using an Lpad to grab the data, but it displays like shown above, with no ordering. Is there a way I can sort these alphanumerically in Oracle SQL?
(The SQL statement)
SELECT *
FROM data_table
ORDER BY LPAD(parameter_type, 10) ASC
OFFSET 0 ROWS FETCH NEXT 1000 ROWS ONLY;
MySQL - Try converting to decimal and checking for value greater than zero -
Oracle - If you are using Oracle you will need to use CASE as it does not have an IF() function. Also, you cannot use CAST as it is not as forgiving as in MySQL.
This checks to see if the first character is [0-9] and if so removes everything apart from [0-9.] and converts it to a number. db<>fiddle