当我根据这段代码准备这个SQL Fiddle时:
WITH l_cur AS
(SELECT to_char(LEVEL - 1, '0000') dd FROM dual CONNECT BY LEVEL <= 10)
SELECT '''' || d1.dd || '''' o,
'''' || d2.dd || '''' n
FROM (SELECT dd,
row_number() over(ORDER BY 1) rn
FROM l_cur) d1,
(SELECT dd,
row_number() over(ORDER BY dbms_random.random) rn
FROM l_cur) d2
WHERE d1.rn = d2.rn;
O N
------- -------
' 0000' ' 0000'
' 0001' ' 0005'
' 0002' ' 0009'
' 0003' ' 0003'
' 0004' ' 0002'
' 0005' ' 0008'
' 0006' ' 0006'
' 0007' ' 0001'
' 0008' ' 0007'
' 0009' ' 0004'
10 rows selected
功能to_char
是在开头添加一个空白字符''(空格)。这是甲骨文的错误吗?