Oracle To Db2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manju82
    New Member
    • Dec 2006
    • 1

    Oracle To Db2

    hi...

    i am new to DB2. i have an oracle query which i need to convert to DB2. the query as follows.

    SELECT MAX(a),
    CASE WHEN b>=x THEN 'N'
    WHEN b<x THEN 'Y' END AS above_limit


    FROM B
    WHERE a<=CURRENT_DAT E
    GROUP BY a,b


    please help me in doing this.

    thanks in advance

    manju
  • Mondo Tofu
    New Member
    • Dec 2006
    • 12

    #2
    I think that this works much the same.

    SELECT MAX(a),
    CASE WHEN b>=x THEN 'N' ELSE 'Y' END AS above_limit
    FROM B
    WHERE a<=CURRENT_DAT E
    GROUP BY a,b


    The only trouble I had was with x until I turned it into a constant.

    If x varies a lot, you might consider writing a function so that you can pass x.

    If x is handled via a SQL Procedure in DB2, then this is not an obstacle.

    Good luck,
    Mondo Tofu

    Comment

    Working...