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 strongm 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
Aug 6, 2001
2
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top