Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

2nd greatest values

user601042Jun 10 2011 — edited Jun 13 2011
Hi ,
I'm having three columns with numbers. I have to find first largest,2nd largest and third largest value
Currently i'm using following logic
ley say col 1 =10 col2=4; col3 = 7

1 greatest = greatest (col1,col2,col3) which is 10
3 greated = least (col1,col2,col3) which is 4
2nd greatst = (10+4+7) - (1st greatest - 3rd greatest) which is 7.

Is there any oracle function like greatest,least to find second largest.

Thanks,
Sujeeth
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 11 2011
Added on Jun 10 2011
5 comments
839 views