rank(), denseRank() etc...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TP

    rank(), denseRank() etc...

    Hi all,

    I am trying to learn DB2 on os390 and this is my version is :
    Database server = DB2 OS/390 7.1.1

    I was trying to run this query
    =============== ======
    SELECT EMPNO, RANK() OVER(ORDER BY EMPNO) AS RANK# ,DENSE_RANK()
    OVER(ORDER BY EMPNO) AS DENSE# FROM DSN8710.EMP ORDER BY EMPNO
    =============== ======
    and i get this error
    =============== =====
    DBA2191E SQL execution error.

    com.ibm.db.Data Exception: A database manager error occurred. :
    [IBM][CLI Driver][DB2] SQL0104N An unexpected token "(" was found
    following "". Expected tokens may include: ", FROM INTO ".
    SQLSTATE=42601
    =============== ===

    Any ideas why I am getting this error? I think 7.1.1 should support
    these functions? I tried these on 3270 but I got the same errors.

    Thanks.
  • PM \(pm3iinc-nospam\)

    #2
    Re: rank(), denseRank() etc...

    I don't think the olap functions are available on mvs/os390/zos db2.

    For portable sql, you can look at the
    The SQL Reference for Cross-Platform Development



    The doc for your version is here


    PM

    "TP" <tpass001@hotma il.com> a écrit dans le message de
    news:5947ff63.0 401200643.ddbb8 8a@posting.goog le.com...[color=blue]
    > Hi all,
    >
    > I am trying to learn DB2 on os390 and this is my version is :
    > Database server = DB2 OS/390 7.1.1
    >
    > I was trying to run this query
    > =============== ======
    > SELECT EMPNO, RANK() OVER(ORDER BY EMPNO) AS RANK# ,DENSE_RANK()
    > OVER(ORDER BY EMPNO) AS DENSE# FROM DSN8710.EMP ORDER BY EMPNO
    > =============== ======
    > and i get this error
    > =============== =====
    > DBA2191E SQL execution error.
    >
    > com.ibm.db.Data Exception: A database manager error occurred. :
    > [IBM][CLI Driver][DB2] SQL0104N An unexpected token "(" was found
    > following "". Expected tokens may include: ", FROM INTO ".
    > SQLSTATE=42601
    > =============== ===
    >
    > Any ideas why I am getting this error? I think 7.1.1 should support
    > these functions? I tried these on 3270 but I got the same errors.
    >
    > Thanks.[/color]


    Comment

    Working...