I have a string, for example X1. I need to create a new string by inserting zeros into it. To be more specific:
for X1 the new string will be X0001;
for X10 the new string will be X0010;
for X100 the new string will be X0100;
for X1000 the new string will be X1000.
The length of the new string is 5.
Run Code Online (Sandbox Code Playgroud)
I have tried to do this:
select substr('X1', 1, 1) || '000' || substr('X1', 2) from dual; …Run Code Online (Sandbox Code Playgroud) 我需要用点替换逗号然后我需要我的值是一个数字.所以我写了这个:
select replace('12345,6789', ',' , '.') from dual --it works fine
Run Code Online (Sandbox Code Playgroud)
但后来我想转换to_number该值,我得到错误:
"invalid number"