但是当使用如下语句 就正常:
SELECT MIN(MINBKT),
MAXBKT,
SUBSTRB(DUMP(MIN(VAL), 16, 0, 32), 1, 120) MINVAL,
SUBSTRB(DUMP(MAX(VAL), 16, 0, 32), 1, 120) MAXVAL,
SUM(REP) SUMREP,
SUM(REPSQ) SUMREPSQ,
MAX(REP) MAXREP,
COUNT(*) BKTNDV,
SUM(CASE
WHEN REP = 1 THEN
1
ELSE
0
END) UNQREP
FROM (SELECT VAL,
MIN(BKT) MINBKT,
MAX(BKT) MAXBKT,
COUNT(VAL) REP,
COUNT(VAL) * COUNT(VAL) REPSQ
FROM (SELECT /*+ no_parallel(t) no_parallel_index(t) dbms_stats cursor_sharing_exact use_weak_name_resl dynamic_sampling(0) no_monitoring */
"POLICY_NO" VAL,
NTILE(254) OVER(ORDER BY "POLICY_NO") BKT
-- NTILE(254) OVER(ORDER BY NLSSORT("POLICY_NO", 'NLS_SORT = binary')) BKT
FROM "AUTO_OPR"."T_APPLY_BASE" T
WHERE "POLICY_NO" IS NOT NULL)
GROUP BY VAL)
GROUP BY MAXBKT
ORDER BY MAXBKT
查询结果:
1 1 1 Typ=1 Len=19: 31,30,31,30,30,30,30,33,30,31,30,36,31,30,30,30,31,34,37 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,34,30,37,30,33,35,35,39,35 52339 52339 1 52339 52339
2 2 2 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,34,30,37,30,33,35,35,39,36 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,34,31,30,30,30,33,32,39,38 52339 52339 1 52339 52339
3 3 3 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,34,31,30,30,30,33,32,39,39 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,35,30,36,30,30,31,32,39,36 52339 52339 1 52339 52339
4 4 4 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,35,30,36,30,30,31,32,39,37 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,35,30,37,30,33,39,30,32,30 52339 52339 1 52339 52339
5 5 5 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,35,30,37,30,33,39,30,32,31 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,35,31,30,30,30,39,37,32,34 52339 52339 1 52339 52339
6 6 6 Typ=1 Len=19: 32,31,30,31,30,30,30,30,31,30,35,31,30,30,30,39,37,32,35 Typ=1 Len=19: 32,31,30,31,30,30,30,30,37,31,39,30,39,30,30,35,33,36,31 52339 52339 1 52339 52339
7 7 7 Typ=1 Len=19: 32,31,30,31,30,30,30,30,37,31,39,30,39,30,30,35,33,36,32 Typ=1 Len=19: 32,31,30,31,30,30,30,30,37,31,39,30,39,30,35,37,37,33,35 52339 52339 1 52339 52339
...
大家帮我看看,Thanks!
|