Skip to Main Content

Logic for Best Matching from possible row...

user481231Dec 14 2010 — edited Dec 17 2010
Hi All,

For example I have below columns and values in my test table

create table test(level1 number,level2 number,level3 number,level4 number,level5 number,level6 number,level7 number,level8 number)

insert into test values(2,3,4,5,6,7,8,9)
insert into test values(12,13,14,15,16,17,18,19)
insert into test values(5,6,7,8,9,11,13,15)
insert into test values(7,8,9,10,11,12,13,14)
insert into test values(9,10,13 ,14,15,16,17,18)
insert into test values(11,22,27,28,29,30,31,32)

select * from test;

2 3 4 5 6 7 8 9 output should be 9
12 13 14 15 16 17 18 19 output should be 12
5 6 7 8 9 11 13 15 output should be 13
7 8 9 10 11 12 13 14 output should be 12
9 10 13 14 15 16 17 18 output should be 13
11 22 27 28 29 30 31 32 output should be 22

when I input a number Ex:12 for each row If there is any column matching exactly it should be dispalyed
IF NOT the most possible highest matching number for that row should be displayed.

is there any in built functions can we use for this ? If anyboyd having this type of logic
please send to me. I think its similar to vlookup in Excel.

Thanks in advance.
Devender
This post has been answered by MichaelS on Dec 15 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Jan 14 2011
Added on Dec 14 2010
10 comments
509 views