1

我有这个查询,我将它转换为十进制,我希望它在左边的垫子上有零,当我运行这个查询时它没有给我输出:

SELECT  LPAD(TO_CHAR(rlseamt,'9999999999999999999999D99'),12,'0') Transaction_Amount  
FROM ln01mast WHERE acno=214
4

1 回答 1

1

你在找这个吗?

SELECT  TO_CHAR(rlseamt,'000000000000D00') Transaction_Amount  
  FROM ln01mast 
 WHERE acno = 214

样本输出:

| TRANSACTION_AMOUNT |
|--------------------|
| 000000002987.87 |

注意:根据需要调整前导零的数量

或(根据您的评论)

SELECT '000000000000' || TO_CHAR(rlseamt,'FM99999999999999D99') Transaction_Amount  
  FROM ln01mast 
 WHERE acno = 214

样本输出:

| TRANSACTION_AMOUNT |
|----------------------|
| 0000000000002987.87 |

这是SQLFiddle演示

于 2013-09-18T05:43:30.933 回答