【发布时间】:2019-08-09 07:43:23
【问题描述】:
我有一个字符串,例如 X1。我需要通过在其中插入零来创建一个新字符串。具体来说:
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.
我已经尝试过这样做:
select substr('X1', 1, 1) || '000' || substr('X1', 2) from dual;
但这仅解决了第一种情况并返回 X0001。
【问题讨论】: