在 DB2 sql 中用 0 填充 smallint for z/os

pad smallint with 0s in DB2 sql for z/os

有什么方法可以在大型机 z/OS 的 DB2 中将 0 填充到 smallint。我没有编写任何程序,而是 运行 直接在 DB2 QMF 上查询。

字段定义:

Column Name  Col type length
some_column  Smallint  2

 some_column     result
 -----------     ------
  288         ==>  0288
  88          ==>  0088
  1224        ==>  1224

在 z/OS 当前支持的所有 DB2 版本中,有一个函数 DIGITS() 可以满足您的需求。