This is an Oracle question.
I need to find the top 5 biggest values in a series of records. Say I have 2000 records, and there is a column that holds number values in each record. I need to check this number field and only select the top 5 biggest.
So if I have these values in my number column
22
3
44
2
23
9
4
2
99
Then the following would be returned
22
44
23
9
99
I’m currently having to parse the number value from the field as it is a string. I parse it with the following
REGEXP_SUBSTR(SUBSTR(ADDITIONAL_INFO, 1 ,
INSTR(ADDITIONAL_INFO, ',', 1,1)), '[0-9]+') "CELLS"
I’m thinking there might be looping and if else selection involved. If this were C# I could do this in a few minutes. But the Oracle syntax is throwing me off.
Please help.
You could try: