add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
select * from V$VERSION;
BANNER BANNER_FULL BANNER_LEGACY CON_ID
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release
Version 23.2.0.0.0
Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release 0
with tbltmp(x, y) as (
select * from (
VALUES
(5215, 57),
(18943, 221),
(18943, 230),
(18943, 238),
(21488, 257),
(21488, 270),
(5215, 67),
(5215, 77),
(5215, 87),
(5215, 97)
) as t(x, y)
),
rtbltmp as (
select d.*,
dense_rank() over(order by x) as rnx,
row_number() over(partition by x order by y) as rny,
count(y) over(partition by x) as cnt
from tbltmp d
)
, solution(x,y, rnx, rny, js) as (
select x,y, rnx, rny, '[' || x || ',' || y || ']'
from rtbltmp
where rnx = 1
union all
select d.x, d.y, d.rnx, d.rny,
r.js || ',[' || d.x || ',' || d.y || ']'
from solution r
join rtbltmp d
on
(d.rnx = r.rnx + 1)
),
GRP X Y
1 5215 97
1 18943 238
1 21488 270
2 5215 57
2 18943 238
2 21488 270
3 5215 67
3 18943 238
3 21488 270
4 5215 77
4 18943 238
4 21488 270
5 5215 87
5 18943 238
5 21488 270
6 5215 97
6 18943 230
6 21488 270
7 5215 57
7 18943 230
7 21488 270
8 5215 67
8 18943 230
8 21488 270
9 5215 77
9 18943 230
9 21488 270
10 5215 87
10 18943 230
10 21488 270
11 5215 97
11 18943 221
11 21488 270
12 5215 57
12 18943 221
12 21488 270
13 5215 67
13 18943 221
13 21488 270
14 5215 77
14 18943 221
14 21488 270
15 5215 87
15 18943 221
15 21488 270
16 5215 97
16 18943 238
16 21488 257
17 5215 57
17 18943 238
17 21488 257
18 5215 67
18 18943 238
18 21488 257
19 5215 77
19 18943 238
19 21488 257
20 5215 87
20 18943 238
20 21488 257
21 5215 97
21 18943 230
21 21488 257
22 5215 57
22 18943 230
22 21488 257
23 5215 67
23 18943 230
23 21488 257
24 5215 77
24 18943 230
24 21488 257
25 5215 87
25 18943 230
25 21488 257
26 5215 97
26 18943 221
26 21488 257
27 5215 57
27 18943 221
27 21488 257
28 5215 67
28 18943 221
28 21488 257
29 5215 77
29 18943 221
29 21488 257
30 5215 87
30 18943 221
30 21488 257