8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Misc » Here

Comments for NTH_VALUE Analytic Function


Jim Dickson said...

Tim
Are you able to explain Nth_VALUE() documenation?
https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/NTH_VALUE.html#GUID-F8A0E88C-67E5-4AA6-9515-95D03A7F9EA0

Specifically
1) why necessary to have prod_id in both PARTITION BY and GROUP BY?
2) why does GROUP BY require channel_id to be included?

Tim... said...

Hi.

It's not "necessary" from an analytics perspective. It was made necessary in this case because they chose to use MIN as an aggregate function, not an analytic function, which means GROUP BY becomes necessary. I think this is a bad example, for this reason.

Cheers

Tim...
Prepared Statement Error: Table './oraclebasecms/cms_page_comment_uuids' is marked as crashed and should be repaired