0.0.0.1 saved in sql table column as 10001.
MY data base contains values as such above mentioned i wanted to sort it based on the values but if I sort is as it is it will give me wrong order so i need tp convert it to the above mentioned format(10001). i.e. Remove the dots(.)
Thank you.
4
Answers
(I guess you’re actually using Oracle as a database, regarding the tool – Oracle SQL Developer – you’ve also tagged, which means that MySQL tag should be removed).
To me, it looks as if you’d want to a) remove dots, b) change datatype to number (so that it is correctly sorted):
It presumes that only characters allowed are digits and dots. If there’s a value like ‘A.0.0.1’, it’ll – of course – fail, as you can’t convert letter A to a number.
Why are you storing the period ‘.’ Character to begin with? If it’s not needed you can remove it.
If you want to remove all non-alphanumeric characters you could use a regular expresion.
You can use the translate command with a SELECT and the data will not be charged in the table.
See below