【发布时间】:2019-09-08 00:50:23
【问题描述】:
是什么让数字 0 成为 Oracle to_char(number,'B9999') 掩码的例外? 在这个查询中,0 根本不打印。
如何将所有数字(包括 0)用空格填充?
lpad() 是唯一的选择吗?
select to_char(0,'B09999') as num_fmt from dual union all
select to_char(0,'B9999') as num_fmt from dual union all
select to_char(300,'B9999') as num_fmt from dual union all
select to_char(-300,'B9999') as num_fmt from dual ;
【问题讨论】:
-
B-Returns blanks for the integer part of a fixed-point number when the integer part is zero (regardless of zeros in the format model)来自doc