469,631 Members | 1,298 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

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_DATE
GROUP BY a,b


please help me in doing this.

thanks in advance

manju
Dec 7 '06 #1
1 1193
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_DATE
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
Dec 10 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by susmita_ganguly | last post: by
63 posts views Thread by Nick Palmer | last post: by
3 posts views Thread by Jon Ole Hedne | last post: by
13 posts views Thread by Chris Botha | last post: by
2 posts views Thread by Ruslan A Dautkhanov | last post: by
reply views Thread by Jack | last post: by
reply views Thread by Winder | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.