Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DECODE in DB2

Status
Not open for further replies.

smita123

Programmer
Joined
Aug 6, 2001
Messages
2
Location
US
Is there any function in DB2 which is similar to DECODE of Oracle? Basically an IF THEN ELSE logical function.

 
Hai,
We have CASE expression in DB2 as workaround for DECODE Function in Oracle.
Eg.
Select DECODE(Name, 'XXX','My Name','Your Name') from TableName;

Select CASE NAME WHEN 'XXX' THEN 'My Name' ELSE 'Your Name' END from TableName

I hope,The above eg. will help you

 
Thanks a lot. It helped me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top