How to use "Rank" function  in Oracle?

I need to display Top 15 records by using rank function.
Here is my query...I need to pull top 15 FAQ's using the below query.. How can I use RANK function to display the Top 15 FAQ"s in the list.
Select  distinct SUb1.FAQ,Sub1.FAQ_Hits,GU.display_Name_FMLS as displayname,ev.ParentLinkrecordid,ev.userid from User GU
Join Event ev
ON LOWER (ev.userid) IN (LOWER (GU.lanid), LOWER (Gu.racfid))
Join (Select distinct sm.stem as FAQ,Sum(ev.Eventresults) as FAQ_Hits,ev.ParentLinkrecordid as Topic_ID from Event ev
Join SubjectMatter sm
ON (TO_CHAR (sm.smrecordid) = ev.eventdetail1) AND ev.eventdetail1 IS NOT NULL AND sm.smtype = 1
Where (Upper(ev.eventsubtype) in (Upper('FAQ'),Upper('OPENFAQ')))
AND TO_DATE (eventdatetime, 'yyyy-mm-dd hh24:mi:ss') >= TO_DATE ('20100601', 'yyyymmdd')
and TO_DATE (eventdatetime, 'yyyy-mm-dd hh24:mi:ss') <= TO_DATE ('20100831', 'yyyymmdd')
Group by sm.stem,ev.Parentlinkrecordid
order by FAQ )sub1
ON Sub1.Topic_ID = ev.ParentLinkrecordid)

A few bits that I noticed in the query ...
in (Upper('FAQ'),Upper('OPENFAQ'))1) Do you really a upper for a string which is already in upper case.
Select distinct sm.stem as FAQ,Sum(ev.Eventresults) as FAQ_Hits,ev.ParentLinkrecordid as Topic_ID2) Do you need a distinct when you are using a GROUP function viz. SUM ?
You rank query is as follows, I am not very good at the ANSI style JOIN so changed it slightly ... :-)
Also notice the usage rank function in the "sub1" query.
select distinct sub1.faq,
                sub1.faq_hits,
                gu.display_name_fmls as displayname,
                ev.parentlinkrecordid,
                ev.userid
from user gu, event ev,
  (select rank() over (order by sum(ev.eventresults) desc) rnk,
          sum(ev.eventresults) as faq_hits,
          sm.stem as faq,         
          ev.parentlinkrecordid as topic_id
     from event ev, subjectmatter sm
    where (to_char(sm.smrecordid) = ev.eventdetail1)
      and ev.eventdetail1 is not null
      and sm.smtype = 1
      AND upper(ev.eventsubtype) in ('FAQ', 'OPENFAQ')
      and to_date(eventdatetime, 'yyyy-mm-dd hh24:mi:ss') >= to_date('20100601', 'yyyymmdd')
      and to_date(eventdatetime, 'yyyy-mm-dd hh24:mi:ss') <= to_date('20100831', 'yyyymmdd')
    group by sm.stem, ev.parentlinkrecordid
    order by faq) sub1
where lower(ev.userid) in (lower(gu.lanid), lower(gu.racfid))
  and sub1.topic_id = ev.parentlinkrecordid)
  and sub1.rnk <= 15;Like mentioned above, some sample data would have helped.

Similar Messages

  • How to use RANK function ?

    Hello everyone,
    here is the query I run in sql developer using RANKFunction.
    SELECT Empno, Ename, Job, Mgr, Hiredate, Sal
    FROM
    (SELECT Empno, Ename, Job, Mgr, Hiredate, Sal,
    *RANK*() OVER
    (ORDER BY SAL Desc NULLS LAST) AS Emp_Rank
    FROM Emp
    ORDER BY SAL Desc NULLS LAST)
    WHERE Emp_Rank < 6;How I can use this query in my report in obiee or is there any replacement of RANK() function in obiee so that I can use that to get my same above result.
    Thanks

    Kuldip wrote:
    Thanks, you are absolutely correct. However, By doing this I am getting my output as whic I was not expecting.
    Students Marks Rank
    student1 95 1
    student2 95 1
    student3 93 3
    student4 93 3
    student5 91 5
    The output should be as instead
    Students Marks Rank
    student1 95 1
    student2 95 1
    student3 93 2
    student4 93 2
    student5 91 3
    Can It be done like this ?
    Thanks.
    Edited by: Kuldip on Mar 15, 2012 11:51 PMHi Boss,
    I think you copied the above scenario from this site..
    http://oracle-bi.siebelunleashed.com/articles/rank-and-dense-rank-functionsobiee/
    Then why asking how to do this? Are you testing us? Doesn't that site say how to achieve this?

  • How to use decode function in oracle apex 3.2.1

    Hello Friends,
    how to use decode
    var_decode := 'decode'||'('|| var1 ||','|| -800000000000000||','||'.A'||','||
    appreciate your help.
    regards/kumar
    Edited by: kumar73 on Apr 23, 2010 12:25 PM
    Edited by: kumar73 on Apr 23, 2010 12:27 PM

    Hey just on this particular point, there's a handy PL/SQL method for escaping quotation characters which may reduce the complexity of the string.
    For example, if I had a string:
    I can't understand why quoting my 'quote' characters never seems to "work"!and I wanted to pass that into a variable, I could do this:
    vc_foo:= 'I can''t understand why my ''quote'' characters never seems to "work"!';or I could use the q function, whereby you enclose your string within a quote delimiter of your choice, like so:
    vc_foo:= q'^I can't understand why quoting my 'quote' characters never seems to "work"!^';
    note: I used the caret (^) character by convention but any valid character will do
    ...all of which leaves your original string more or less unadulterated.
    I find this particularly useful for generating dynamic SQL and dynamic PL/SQL, as it leave the query looking a tad more readable, although if you are chaining together multiple strings with double-pipes, it can make it a little muddier. I find it particularly useful if I'm going to deal with string data from, for example, a field with Irish-derived surnames such as "O'Reilly"...
    Give it a go!

  • How to use rank function in obiee rpd using evalute..

    i created a logical column:
    EVALUATE('RANK() OVER (PARTITION BY %1,%2)' AS DOUBLE PRECISION , Composites.Composites_Fact.MEMBER_LOCKED_BASE_RETURN, Composites.Composites_Fact.COMP_ID)
    please provide some solution

    There is a known bug with EVALUATE when returning numbers. When I has the same problem Oracle Metalink has adviced to use CAST on the end result of the EVALUATE and return it as a FLOAT datatype.
    CAST(EVALUATE('my_function(%1)', logical_table.ROWID) AS FLOAT)

  • How to use DLL function in Oracle Forms 5.0?

    for instance, the FindWindowA function in "user32.dll"
    please advise, thanks

    Take a look at ORA_FFI package.

  • How to use complex function as condition in Oracle Rule Decision Table?

    How to use complex function as condition in Oracle Rule Decision Table?
    We want to compare an incoming date range with the date defined in the rules. This date comparison is based on the input date in the fact & the date as defined for each rule. Can this be done in a decision table?

    I see a couple of problems here.
    First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
    Prabu ammaiappan wrote:
    Hi,
    I Have a group function in the Query. Below is the Query i have used it,
    GROUP BY S.FREIGHTCLASS,
    R.CONTAINERKEY,
    S.SKU,
    S.DESCR ||S.DESCRIPTION2,
    S.PVTYPE,
    RD.LOTTABLE06,
    R.WAREHOUSEREFERENCE,
    RD.TOLOC,
    R.ADDWHO,
    R.TYPE,
    S.CWFLAG,
    S.STDNETWGT,
    S.ORDERUOM,
    R.ADDDATE,
    C.DESCRIPTION,
    (CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
    NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
    RDD.BRAND,
    S.NAPA,
    RD.RECEIPTKEY,
    R.SUSR4,
    P.POKEY,
    RDD.SUSR1,
    r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
    rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
    If you want to apply a filter condition such as:
    trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
    select ....
      from ....
    where ....
    group by ....
    having max(some_date) between this_date and that_date;Hope that helps,
    -Mark

  • Oracle:how to use max() function in case expression

    how to use max() function in case expression, Please explain with any example

    Hope this helps and should be self explanatory
    with t as
    (select 1 col,100 col2 from dual union
    select 2 ,100 from dual union
    select 2 ,200 from dual union
    select 3,100  from dual union
    select 3,200  from dual  )
    select col, case when max(col2)=100 then 'with 100 range'
    when  max(col2)=200 then 'with 200 range' end  from t group by col

  • How to use FPRINT32 function in MF cobol

    Hi,
    How to use FPRINT32 function to check the value of any buffer defined in MF cobol code.
    When we tried, CALL FPRINT32 USING OUTPUT-FML
    OUTPUT-FML is a buffer which is defined in our cobol code.
    We are getting below error.
    ld: 0711-224 WARNING: Duplicate symbol: p_xargc
    ld: 0711-224 WARNING: Duplicate symbol: p_xargv
    ld: 0711-224 WARNING: Duplicate symbol: .tpsvrdone
    ld: 0711-224 WARNING: Duplicate symbol: .tpsvrinit
    ld: 0711-224 WARNING: Duplicate symbol: TPSVRINIT
    ld: 0711-224 WARNING: Duplicate symbol: .TPSVRINIT
    ld: 0711-224 WARNING: Duplicate symbol: tpsvrinit
    ld: 0711-224 WARNING: Duplicate symbol: tpsvrdone
    ld: 0711-224 WARNING: Duplicate symbol: .userlog
    ld: 0711-224 WARNING: Duplicate symbol: userlog
    ld: 0711-224 WARNING: Duplicate symbol: p_xrcfg
    ld: 0711-224 WARNING: Duplicate symbol: p_xrc
    ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
    ld: 0711-317 ERROR: Undefined symbol: .FPRINT32
    CMDTUX_CAT:1832: ERROR: can't execute cobcc -I$TUXDIR/include -L/lib -lpthreads -L/usr/local/opt/oracle/product/ostl133/lib/ -lclntsh -lrtl -lld -lm /lib/crt0_64.o -ldl -lc -lm -lpthreads -lodm -lbsd_r -lld -lperfstat -lm -lc_r -lpthreads /usr/local/opt/oracle/product/ostl133/precomp/lib/cobsqlintf.o /usr/local/opt/oracle/product/ostl133/lib/libclntsh.a -C linkcount=1024 -o BS-f804a.c -L${TUXDIR}/lib TPSVRINIT.o -brtl -qstaticinline -lcobatmis -ltux -lbuft -lfml -lfml32 -lengine -lpthread
    Please help in this regard,
    Thanks

    Hi,
    As far as I know there is no FPRINT32 function in the Tuxedo COBOL interface.
    The ATMI COBOL Function Reference for the latest Tuxedo 11.1.1.2.0 release at
    http://download.oracle.com/docs/cd/E18050_01/tuxedo/docs11gr1/rf3cbl/rf3cbl.html shows FINIT, FINIT32, FVFTOS, FVFTOS32, FVSTOF, and FVSTOF32 as the only supported COBOL interface functions related to FML.
    COBOL is better suited to dealing with the fixed record structure of views than with the variable record format of FML buffers. The COBOL interface offers functions to initialize and FML buffer and to convert an FML buffer to and from a VIEW so that preexisting services taking FML buffers as input or output parameters can be called, but the expectation is that the COBOL program will conver the FML buffer to a VIEW before accessing it.
    It is possible to call the Tuxedo C interface Fprint32() function from COBOL using standard interlanguage calling conventions. Also, you may want to check with other developers on your project to see if someone may have already implemented such a function.
    Regards,
    Ed

  • Error using Rank function in Answers

    Hi All,
    Am trying to generate a report in Answers which lists Top Accounts with Revenue.
    I Ranked the Revenue field and it is returning me correct values. ( Rank(account.revenue) )
    But, when I try to filter on this field and restrict the rows which shows only top 10 Accounts, it is returning the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1792, message: ORA-01792: maximum number of columns in a table or view is 1000 at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
    Can any one help me on this.
    Thanks in Advance,
    Imtiaz.

    Hi Joe,
    This is the Physical query generated when I use Rank function and the report is fine.
    select distinct D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10,
    D1.c11 as c11,
    D1.c12 as c12,
    D1.c13 as c13,
    D1.c14 as c14,
    D1.c15 as c15
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10,
    D1.c11 as c11,
    D1.c12 as c12,
    D1.c13 as c13,
    D1.c14 as c14,
    D1.c15 as c15
    from
    (select Case when D1.c1 is not null then Rank() OVER ( ORDER BY D1.c1 DESC NULLS LAST ) end as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c1 as c4,
    D1.c4 as c5,
    D1.c5 as c6,
    D1.c6 as c7,
    D1.c7 as c8,
    D1.c8 as c9,
    D1.c9 as c10,
    D1.c10 as c11,
    D1.c11 as c12,
    D1.c12 as c13,
    D1.c13 as c14,
    D1.c14 as c15,
    ROW_NUMBER() OVER (PARTITION BY D1.c1, D1.c2, D1.c3, D1.c4, D1.c5, D1.c6, D1.c7, D1.c8, D1.c9, D1.c10, D1.c11, D1.c12, D1.c13, D1.c14 ORDER BY D1.c1 ASC, D1.c2 ASC, D1.c3 ASC, D1.c4 ASC, D1.c5 ASC, D1.c6 ASC, D1.c7 ASC, D1.c8 ASC, D1.c9 ASC, D1.c10 ASC, D1.c11 ASC, D1.c12 ASC, D1.c13 ASC, D1.c14 ASC) as c16
    from
    (select distinct T690.SUM_REVN_AMT as c1,
    T690.NAME as c2,
    T2216.NAME as c3,
    T690.X_PETROFAC_REVN as c4,
    T690.SUM_WIN_PROB as c5,
    T690.X_PERCENT_GET as c6,
    T690.SUM_WIN_PROB * T690.X_PERCENT_GET / nullif( 100, 0) as c7,
    T690.X_EC_PRIORITY as c8,
    T19028.LOGIN as c9,
    T690.X_COUNTRY as c10,
    T690.X_REGION as c11,
    T18311.NAME as c12,
    T18641.NAME as c13,
    T18238.NAME as c14
    from
    SIEBEL.S_BU T18238 left outer join (
    SIEBEL.S_USER T19028 left outer join (
    SIEBEL.S_OPTY T690 left outer join SIEBEL.S_STG T2216 On T690.CURR_STG_ID = T2216.ROW_ID) left outer join SIEBEL.S_ORG_EXT T1189 On T690.PR_DEPT_OU_ID = T1189.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18311 /* Competitor */ On T690.PR_CMPT_OU_ID = T18311.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18641 /* Partner */ On T690.PR_PRTNR_ID = T18641.ROW_ID) left outer join SIEBEL.S_POSTN T19114 On T690.PR_POSTN_ID = T19114.PAR_ROW_ID) left outer join SIEBEL.S_OPTY_BU T18280 On T690.ROW_ID = T18280.OPTY_ID) left outer join SIEBEL.S_OPTY_X T19415 On T690.ROW_ID = T19415.PAR_ROW_ID) On T19028.PAR_ROW_ID = T19114.PR_EMP_ID) On T18238.ROW_ID = T18280.BU_ID
    ) D1
    ) D1
    where ( D1.c16 = 1 )
    ) D1
    order by c1 desc
    But When I apply Filter on this Rank column then it gives me the error. THis is the Physical query for that
    select distinct Case when D1.c1 is not null then Rank() OVER ( ORDER BY D1.c1 DESC NULLS LAST ) end as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c1 as c4,
    D1.c4 as c5,
    D1.c5 as c6,
    D1.c6 as c7,
    D1.c7 as c8,
    D1.c8 as c9,
    D1.c9 as c10,
    D1.c10 as c11,
    D1.c11 as c12,
    D1.c12 as c13,
    D1.c13 as c14,
    D1.c14 as c15
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10,
    D1.c11 as c11,
    D1.c12 as c12,
    D1.c13 as c13,
    D1.c14 as c14
    from
    (select T690.SUM_REVN_AMT as c1,
    T690.NAME as c2,
    T2216.NAME as c3,
    T690.X_PETROFAC_REVN as c4,
    T690.SUM_WIN_PROB as c5,
    T690.X_PERCENT_GET as c6,
    T690.SUM_WIN_PROB * T690.X_PERCENT_GET / nullif( 100, 0) as c7,
    T690.X_EC_PRIORITY as c8,
    T19028.LOGIN as c9,
    T690.X_COUNTRY as c10,
    T690.X_REGION as c11,
    T18311.NAME as c12,
    T18641.NAME as c13,
    T18238.NAME as c14,
    Case when T690.SUM_REVN_AMT is not null then Rank() OVER ( ORDER BY T690.SUM_REVN_AMT DESC NULLS LAST ) end as c15
    from
    SIEBEL.S_BU T18238 left outer join (
    SIEBEL.S_USER T19028 left outer join (
    SIEBEL.S_OPTY T690 left outer join SIEBEL.S_STG T2216 On T690.CURR_STG_ID = T2216.ROW_ID) left outer join SIEBEL.S_ORG_EXT T1189 On T690.PR_DEPT_OU_ID = T1189.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18311 /* Competitor */ On T690.PR_CMPT_OU_ID = T18311.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18641 /* Partner */ On T690.PR_PRTNR_ID = T18641.ROW_ID) left outer join SIEBEL.S_POSTN T19114 On T690.PR_POSTN_ID = T19114.PAR_ROW_ID) left outer join SIEBEL.S_OPTY_BU T18280 On T690.ROW_ID = T18280.OPTY_ID) left outer join SIEBEL.S_OPTY_X T19415 On T690.ROW_ID = T19415.PAR_ROW_ID) On T19028.PAR_ROW_ID = T19114.PR_EMP_ID) On T18238.ROW_ID = T18280.BU_ID
    ) D1
    where ( D1.c15 <= 10 )
    ) D1
    order by c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15
    Thanks,
    Imtiaz

  • How to use read_text function module

    Hi how to use read_text function module to read purchase order header text .what are all tht things to pass in ID,Name and Object
    thanks,
    Mahe

    Dear,
    Use below code.
    DATA:IT_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE,
    V_TDNAME LIKE THEAD-TDNAME.
    V_TDNAME = PO_NUMBER.
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
    *   CLIENT                        = SY-MANDT
        ID                            = 'F01'
        LANGUAGE                      = 'EN'
        NAME                          = V_TDNAME
        OBJECT                        = 'EKKO'
      TABLES
        LINES                         = IT_LINE.
    Thanks and Regards,

  • How to use java source in Oracle when select by sqlplus.

    How to use java source in Oracle when select by sqlplus.
    I can create java source in Oracle
    import java.util.*;
    import java.sql.*;
    import java.util.Date;
    public class TimeDate
         public static void main(String[] args)
    public String setDate(int i){
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(new Date((long)i*1000));
    System.out.println("Dateline: "
    + calendar.get(Calendar.HOUR_OF_DAY) + ":"
    + calendar.get(Calendar.MINUTE) + ":"
    + calendar.get(Calendar.SECOND) + "-"
    + calendar.get(Calendar.YEAR) + "/"
    + (calendar.get(Calendar.MONTH) + 1) + "/"
    + calendar.get(Calendar.DATE));
    String n = calendar.get(Calendar.YEAR) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.DATE);
         System.out.print(n);
         return n;
    I have table name TEST
    ID DATE_IN
    1 942685200
    2 952448400
    When I write jsp I use method setDate in class TimeDate
    The result is
    ID DATE_IN
    1 1999/11/16
    2 2003/7/25
    Thanks you very much.

    It is unclear where you are having a problem.  Is your issue at runtime (when the form runs in the browser) or when working in the Builder on the form?
    Also be aware that you will need to sign your jar and include some new manifest entries.  Refer to the Java 7u51 documentation and blogs that discuss the changes.
    https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias
    http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html

  • How to use standard function keys as custom keys

    how to use standard function keys as custom keys.
    i have encountered that problem while developing a screen, there i'm supposed to use standard function key F2 ( which actually meant for choose) for clearing the screen fields where the cursor is present and f1 for saving data that entered in screen fields, etc...
    kindly help me out.

    Hi ,
    Solution to use SAP reserve function keys F1 .. F4 (mostly this requirement comes up for RF screens) can be acheived by assigning your new Function code using the Menu path Utilities --> F key Consistency in the Menu Painter (SE41) . Once you assign your cutom function code to the standard Fn keys the only remaining step is to make sure that you set a curson on any of the field on sceen by using the Key Word "SET CURSOR" .
    If you dont use the key word SET CURSOR in the PBO of the screen then you might not see any response for F4.
    Thanks

  • How to use unicode fonts in Oracle forms 10g?

    Hi I am working in forms 10g for quite a long time, the software that I have developed so far are all in English language. Now I have requirements to use Bengali Fonts in Forms 10g. I am facing difficulties doing that. Please reply with help. Thanks
    Hasan Al Mamun

    Check this forum post (though that is for 6i, it would be of helpful for you)
    How to use unicode fonts in Oracle forms 10g?
    -Arun

  • How to  use  crystal reports in oracle Jdeveloper

    Hi,
    I was implemented crystal reports in Crystal reports for eclipse also i made .rpt & .JSP how to use these file in oracle JDeveloper 10 g
    can any one please help regarding this matter send any information if avilable send me on my mail My mail id: - [email protected]
    Thank you !
    regards,
    Amol

    you are in the Oracle Forms Forum and your question is related to JDeveloper and Crystal Reports, you think those two are linked to Oracle Forms in anyway??
    Please post your questions in the appropriate Forum.
    Tony

  • RANK FUNCTION IN ORACLE 8I

    제품 : PL/SQL
    작성날짜 : 2001-09-11
    RANK FUNCTION IN ORACLE 8I
    ==========================
    EXPLANATION
    oracle 8i(8.1.6) 부터 가능한 rank function 입니다.
    8.1.5 에서는 ora-923 error 가 납니다.
    plsql 내에서는 oracle 9i 부터 가능합니다.
    8.1.6에서는 ora-900 error가 납니다.
    EXAMPLE
    <RANK() OVER ( query_partition_clause ORDER_BY clause) >
    - 중복 rank 값만큼 다음 순위는 생략
    SQL>SELECT deptno, ename, sal, comm,
    RANK() OVER (PARTITION BY deptno ORDER BY sal DESC, comm) as rk
    FROM emp;
    DEPTNO ENAME SAL RK
    10 KING 5000 1
    10 CLARK 2450 2
    10 MILLER 1300 3
    20 3500 1
    20 SCOTT 3000 2
    20 FORD 3000 2
    20 JONES 2975 4
    20 ADAMS 1100 5
    20 SMITH 800 6
    30 BLAKE 2850 1
    30 ALLEN 1600 2
    30 TURNER 1500 3
    30 WARD 1250 4
    30 MARTIN 1250 5
    40 JAMES 777 1
    9 1
    <DENSE_RANK( ) OVER ( query_partition_clause ORDER_BY clause ) >
    - 중복 rank 의 수와 무관하게 numbering
    SQL>SELECT dname, ename, sal, DENSE_RANK()
    OVER (PARTITION BY dname ORDER BY sal) as drank
    FROM emp, dept
    WHERE emp.deptno = dept.deptno
    AND dname IN ('SALES', 'RESEARCH');
    DNAME ENAME SAL DRANK
    RESEARCH SMITH 800 1
    RESEARCH ADAMS 1100 2
    RESEARCH JONES 2975 3
    RESEARCH SCOTT 3000 4
    RESEARCH FORD 3000 4
    RESEARCH 3500 5
    SALES WARD 1250 1
    SALES MARTIN 1250 1
    SALES TURNER 1500 2
    SALES ALLEN 1600 3
    SALES BLAKE 2850 4
    plsql 내에서 사용 가능 :oracle 9i 부터
    SQL> create table
    rank_emp(deptno number(2), ename varchar2(20), sal number(5), rk number(2));
    테이블이 생성되었습니다.
    SQL> create or replace procedure window_plsql AS
    query_str VArchar2(1000);
    begin
    query_str := 'insert into rank_emp
    SELECT deptno, ename, sal,
    RANK() OVER (PARTITION BY deptno ORDER BY sal DESC, comm) as rk
    FROM emp' ;
    Execute Immediate query_str;
    end;
    2 /
    프로시저가 생성되었습니다.
    SQL> exec window_plsql
    PL/SQL 처리가 정상적으로 완료되었습니다.
    SQL> select * from rank_emp;
    DEPTNO ENAME SAL RK
    10 KING 5000 1
    10 CLARK 2450 2
    10 MILLER 1300 3
    20 SCOTT 3000 1
    20 FORD 3000 1
    20 JONES 2975 3
    20 ADAMS 1100 4
    20 SMITH 800 5
    30 BLAKE 2850 1
    30 ALLEN 1600 2
    30 TURNER 1500 3
    DEPTNO ENAME SAL RK
    30 WARD 1250 4
    30 MARTIN 1250 5
    30 JAMES 950 6
    14 개의 행이 선택되었습니다.

    That's correct
    The differences between Standard and Enterprise Edition are listed here:
    http://www.oracle.com/technology/products/oracle8i/pdf/8i_fam.pdf

Maybe you are looking for

  • Maps, lack of color / contrast in drive mode

    I have updated by n8 with Anna and Maps 3.08, 11wk41 b02, map version 0.2.43.117. It works fine except when driving to a destination on a freeway / motorway.  The roadway is a gray color that blends into the background and even though it zooms in at

  • How to send a  mail to outlook   from iphone flex 4.5.1 app automatically..?

    HI folks,                  i have to send a mail to outlook for correpanding mailler id  with out  opeing  outlook  from my app(iphonoe flex 4.5.1 app.) with taking the input values what ever  we have given as input those values has to be send to out

  • Difference of Time Field in Seconds

    Hello Experts, I have Created two UDFs of Start Time & End Time on Production Order With Type Hour as SAP Supports now i want difference between End Time & Start Time in Seconds Please Suggest Query.... Regards, Bhavank

  • Clicking on a doc file link uses a path to a corrupted Open Office executable

    In a response to my original question, the Tools/Options/Applications window was suggested for handling content type. However, for me, no content types or actions are shown, so I cannot specify a path to the valid version of Open Office.

  • HTML Link ( a href)- wrong behaviour

    Hello, This simple code <a href="javascript:$('.div-feedback').fadeIn();"> doesn't work in my newest version of firefox 29.0.1. it works on chrome just fine as it should. rather than interpret as javascript, it reads as an url (opens the page "javasc