我有以下选择产生错误。 [1]:ORA-01467:排序键太长 这来自旧的代码块,我无法从表中删除列。还有其他方法可以解决此错误吗?
SELECT distinct c_id,
LTRIM(MAX(SYS_CONNECT_BY_PATH(uW,','))
KEEP (DENSE_RANK LAST ORDER BY curr),',') AS uW
FROM (SELECT distinct c_id,
uW,
ROW_NUMBER() OVER (PARTITION BY c_id ORDER BY uW) AS curr,
ROW_NUMBER() OVER (PARTITION BY c_id ORDER BY uW) -1 AS prev
FROM tmp2)
GROUP BY c_id
CONNECT BY prev = PRIOR curr AND c_id = PRIOR c_id
START WITH curr = 1;
答案 0 :(得分:1)
根据Oracle文档,排序/分组列的总长度+一些开销不得超过块大小(通常为8K)。使用较新的Oracle版本,例如charset AL32UTF8,tmp2.uW ortmp2.c_id的列大小可能会超过4000个字符,并且会超过8000个字节。