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.

Question regarding model clause

747323Jan 18 2010 — edited Jan 20 2010
{size:14}
Is there any way that I can make the following query as I meant?
{size}
SELECT  RNK,
        FIRST,
        SECOND
FROM    (
        SELECT 1 RNK FROM DUAL
        UNION ALL
        SELECT 2 RNK FROM DUAL
)
MODEL
DIMENSION BY ( RNK )
MEASURES ( 
        0 FIRST, 
        0 SECOND
)
RULES (
        FIRST[1] = 1,
        FIRST[RNK > 1] = SECOND[CV(RNK) - 1] + 1,
        SECOND[ANY] = FIRST[CV()] + 2
)
{size:14}
I wish to make the result something like following.
{size}
      RNK        FIRST      SECOND
---------- ---------- ----------
         1          1          3
         2          4          6
{size:14}
Any suggestion?
Thanks in advance.
{size}

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 17 2010
Added on Jan 18 2010
4 comments
1,047 views