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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

row_number() is non diterministic.

947771Mar 1 2013 — edited Mar 7 2013
hi,

empid frist name sal DEPARTMENT_ID
123 Shanta 7000 50
122 Payam 8000 50
120 Matthew 8000 50
121 Adam Fripp 8200 50



SELECT
Department_id, first_name, salary,
ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary desc) RN_NO
FROM employees
ORDER BY department_id, salary

i read that row_number is non deterministin so i show that if it is non deterministic then also i will have

empid frist name sal DEPARTMENT_ID RN_NO
123 Shanta 7000 50 4
122 Payam 8000 50 3
120 Matthew 8000 50 2
121 Adam Fripp 8200 50 1


or this

empid frist name sal DEPARTMENT_ID RN_NO
123 Shanta 7000 50 4
122 Payam 8000 50 2
120 Matthew 8000 50 3
121 Adam Fripp 8200 50 1

that is empid 122 and 120 may get 2 or 3 but empid 121 will get 1 and 123 will get 4 RN_NO.


please correct me.

yours sincerely
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 4 2013
Added on Mar 1 2013
14 comments
526 views