Question

Is it possible to have an transient attribute, in an entity based view object that would result in query, with the following in its select list:

   ROW_NUMBER() OVER (
      PARTITION BY A, B
      ORDER BY C
   ) AS AttrName
Was it helpful?

Solution

not sure if understand the question correctly, but as far as I understand - you need Oracle analytic functions inside some particular VIEW definition. Is that correct? this works fine (emp is the standard table which is delivered with different oracle schema. In my case I used Apex schema, as far as I remember it exists in SCOTT schema also) :

create or replace view emp_serialized as
SELECT empno, deptno, hiredate,
ROW_NUMBER( ) OVER (PARTITION BY
deptno ORDER BY hiredate
NULLS LAST) SRLNO
FROM emp
WHERE deptno IN (10, 20)
ORDER BY deptno, SRLNO;

select * from EMP_SERIALIZED;

Here is the output:

view EMP_SERIALIZED created.
     EMPNO     DEPTNO HIREDATE       SRLNO
---------- ---------- --------- ----------
      7782         10 09-JUN-81          1 
      7839         10 17-NOV-81          2 
      7934         10 23-JAN-82          3 
      7369         20 17-DEC-80          1 
      7566         20 02-APR-81          2 
      7902         20 03-DEC-81          3 
      7788         20 09-DEC-82          4 
      7876         20 12-JAN-83          5 

 8 rows selected 

If I didn't understand your question correctly - please rephrase it or try to explain in details..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top