Skip to content
Advertisement

Need to get appropriate/expected row number in Oracle PLSQL

Getting the following output when i use the below query

enter image description here

But the expected output should be as below (Refer RowNumber column)

enter image description here

Advertisement

Answer

First find “groups” each of those rows belongs to (partitioned by refnum and name) (that’s what the temp CTE does), and then apply dense_rank to fetch the final result.

Sample data (simplified, as I don’t have your tables):

Query begins here:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement