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!

Maximum Employees hired in a year in a department

Orcl ApexMay 12 2017 — edited May 12 2017

Hi All,

Question I am able to resolve with simple sql but this is just for learning purpose.

While pulling department who hired maximum number of employees in year mentioned error is coming, why it's coming and how I can avoid it using hint shown in error message.

select *

from employees

model

dimension by ( department_id, to_char(hire_date,'YYYY') as h_year)

measures (0 as cnt, 0 as rnk)

rules

(

cnt[any, any]=count(cnt)[any, cv()],

rnk[any, any]=dense_rank() over (order by cnt desc));

ORA-32638: Non unique addressing in MODEL dimensions

32638. 00000 -  "Non unique addressing in MODEL dimensions"

*Cause:    The address space defined for the MODEL (partition by and dimension by

           expressions) do not uniquely identify each cell.

*Action:   Rewrite the MODEL clause. Using UNIQUE SINGLE REFERENCE

           option might help.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2017
Added on May 12 2017
6 comments
566 views