Why is Oracle's to_char() function adding spaces?

后端 未结 4 526
[愿得一人]
[愿得一人] 2021-02-03 17:25

Why is Oracle\'s to_char() function adding spaces?

select length(\'012\'), 
       length(to_char(\'012\')), 
       length(to_char(\'12\', \'000\')         


        
4条回答
  •  梦谈多话
    2021-02-03 17:45

    To make the answers given more clear:

    select '['||to_char(12, '000')||']', 
           '['||to_char(-12, '000')||']', 
           '['||to_char(12,'FM000')||']' 
    from dual
    
    
    [ 012]                      [-012]                       [012]  
    

提交回复
热议问题