1

我需要将NUMBEROracle中的数据类型格式化如下:

问题陈述:

  -> Append trailing zeros to the ATM_CARD-NUMBER whose length is 14

我的尝试:

SELECT to_char(atm_card_nbr,'9999999999999900')as new_atm_nbr,atm_card_key from atm_card_dm where LENGTH(TRANSLATE(TO_CHAR(atm_card_nbr),'1234567890.-','1234567890'))=14;

结果:

我浏览了几个与 Oracle 相关的在线站点,但找不到正确的结果。那么,怎样才能得到正确的结果呢?

提前致谢!

4

1 回答 1

0
SELECT rpad(to_char(atm_card_nbr),16,'0') as new_atm_nbr,
       atm_card_key 
from atm_card_dm 
  where LENGTH(TRANSLATE(TO_CHAR(atm_card_nbr),'1234567890.-','1234567890'))=14;
于 2013-05-14T10:00:53.687 回答