处理目前看起来像这样的报告:
5 - Kirk Korver, UMKC
15 - Kendall Anthony, Richmond
Players With 30:
41 - Matt Staff, Texas State
我想让它看起来如下:
5 - Kirk Korver, UMKC
15 - Kendall Anthony, Richmond
Players With 30:
41 - Matt Staff, Texas State
*notice how the dashes are in line
我可以使用pl / sql中的内置函数吗?
答案 0 :(得分:2)
不要将其视为“如果是一个数字,请在我的号码前添加一个空格”。而是打印一个右对齐的空格填充两位数字。
您希望像这样使用Oracle TO_CHAR()
函数。
SELECT TO_CHAR( player_number, '99' ) AS formatted_player_number FROM....
答案 1 :(得分:0)
你能做到:
RIGHT('00' + cast([Id] AS VARCHAR(2)), 2) AS PaddedId
或
LPAD(Id, 2, '0')
答案 2 :(得分:0)
试试这个:
LPAD(player_number, 2,' ')