How to display the leading zero's in a number of oracle

前端 未结 4 1876
伪装坚强ぢ
伪装坚强ぢ 2021-01-06 04:02

I have an oracle column(artnr) contains a length of 1 which is of type number(9). I want to update the number as following...

Example :

If number is 0 then i

4条回答
  •  無奈伤痛
    2021-01-06 04:53

    If you really want to store those numbers with preceeding zeroes then you must change the datatype to varchar2. Then you can apply to_char( artnr , 'fm00009') in the update statement. Of course, this might come with unintended consequences. Go for this solution at your own risk.

    You might also consider creating a view that zero-paddes the number "on the fly" when you select from that view.

提交回复
热议问题