jim_bob_jim
asked on
ORACLE - split string and populate column to exclude 0's
Hello.
I need a few pointers in the best way to achieve the following....
Im using ORACLE 10G database.
I have a table with a column of type VARCHAR2(30 BYTE)
The data within that column is for example like...... 0000200001007D
currently I have it so that the string is split so that it populates for example 3 separate columns using the SUBSTRB command.
EG 0000200001007D - would become
00002
00001
007D
where the first 5 bits would be in one column and then the next 5 bits in the next etc etc.....
HOWEVER! I wish to be able to have it so that I can spilt the string and then populate it within 1 new column and have it without the zeros
for example
0000200001007D...... to be split out to become......... 217D
What would be the best way to achieve this??
It is stored so that the every 5 bits display a certain part so I just need to be able to split it all out into one column and have it so that it identifies the zeros and does not include them in the split.
Any help / ideas guys??
cheers and thanks in advance - Jim
I need a few pointers in the best way to achieve the following....
Im using ORACLE 10G database.
I have a table with a column of type VARCHAR2(30 BYTE)
The data within that column is for example like...... 0000200001007D
currently I have it so that the string is split so that it populates for example 3 separate columns using the SUBSTRB command.
EG 0000200001007D - would become
00002
00001
007D
where the first 5 bits would be in one column and then the next 5 bits in the next etc etc.....
HOWEVER! I wish to be able to have it so that I can spilt the string and then populate it within 1 new column and have it without the zeros
for example
0000200001007D...... to be split out to become......... 217D
What would be the best way to achieve this??
It is stored so that the every 5 bits display a certain part so I just need to be able to split it all out into one column and have it so that it identifies the zeros and does not include them in the split.
Any help / ideas guys??
cheers and thanks in advance - Jim
ASKER
yes that is the end result but I need to be able to have it so that I can select it by entering the column name and not the actual string itself. so it replaces all the string in that column.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
select REPLACE('0000200001007D', '0') FROM dual;
REPL
----
217D