[SOLVED] SQL READING THE COLUMN VALUES?

Issue

This Content is from Stack Overflow. Question asked by suprith M

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.

Solution

You can use the translate command with a SELECT and the data will not be charged in the table.

See below

create table t (nm varchar2(20));

insert into t values ('.0.0.0.1');
insert into t values ('10.0.1.1.0');
commit;


SELECT translate(nm, '*.','*') from t

TRANSLATE(NM,'*.','*')
0001
100110

Answered by Beefstu,

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5.CC BY-SA 3.0.CC BY-SA 4.0.

people found this article helpful. What about you?