如何获得三个字符的结果

时间:2016-02-26 10:13:54

标签: sql oracle

我需要获得一个包含三个字符而不是一个字符的列值。

这是我的要求:f = j.merge({ hasRecievedData: true, data: m.get("staffs").map(function(x){ return x.set("hideDetails",true); }) });

这就是结果:

enter image description here

我需要select rank() over (order by 1,2,32 ) from dual而不是001

感谢您的帮助

4 个答案:

答案 0 :(得分:1)

使用LPAD()

SELECT LPAD( '1', 3, '0' ) FROM DUAL;

输出:

001

将其包裹在您的查询中:

SELECT LPAD( rank() over (order by 1,2,32 ), 3, '0' )
FROM   DUAL;

答案 1 :(得分:1)

可能是最直接的解决方案:

select to_char(rank() over (order by 1,2,32 ),'fm000') from dual

答案 2 :(得分:0)

IMO,您可以像这样使用! not a valid url: https://docs.google.com/spreadsheets/d/1101qb2Vz0ZW7cjnTpjBpOP71wy7iOcXdqPug0F37xYA/edit#gid=0 Traceback (most recent call last): File "C:/Users/Abdul/PycharmProjects/examples/main.py", line 4, in <module> reader = GSpreadsheet(url=url) File "C:\Python27\lib\site-packages\gspreadsheet\gspreadsheet.py", line 191, in __init__ self.key = re.search(r'key=([0-9a-zA-Z\-]+)', url).group(1) AttributeError: 'NoneType' object has no attribute 'group'

SUBSTR()

尚未测试;)。

答案 3 :(得分:0)

select lpad(rank() over (order by 1,2,32 ),3,0) from dual;

select substr('00' || rank() over (order by 1,2,32 ),1,3) from dual;