SQL*Plus (MOSC)

MOSC Banner

SQL: Select Closest Range Distance

edited Nov 1, 2017 2:05PM in SQL*Plus (MOSC) 18 commentsAnswered

Hello Guru,

I have below data

CREATE TABLE ZZ1

  (DOCNBR VARCHAR(10), PRIORITY NUMBER, LOC_NBR NUMBER

  );

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D1',5000,72);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D1',5000,172);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D1',5000,188);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D1',5000,475);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D2',5000,72);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D2',5000,165);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D2',5000,189);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D3',5000,474);

insert into ZZ1 (DOCNBR,PRIORITY,LOC_NBR ) values ('D4',5000,476);

Tagged:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center