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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CASE statement query

Status
Not open for further replies.

MarcLodge

Programmer
Feb 26, 2002
1,886
GB
Hi all,
Can you have a WHERE statement in a CASE clause, because I can't seem to get it to work. For instance:

SELECT
CASE
WHEN IBMREQD IN ('Y') THEN 'FOUND'
ELSE 'NOT'
END CASE
FROM SYSIBM.SYSDUMMY1

works fine, but:

SELECT
CASE
WHEN IBMREQD IN ('Y', 'N') THEN 'FOUND'
ELSE 'NOT'
END CASE
FROM SYSIBM.SYSDUMMY1

gives me back an error message - "The search-condition in a SEARCH-WHEN-CLAUSE is not valid."





 
What platform are you on?
I tried successfully exactly the same SQL statement on iSeries-BD2 (AS/400)platform.

SELECT
CASE
WHEN IBMREQD IN ('Y', 'N') THEN 'FOUND'
ELSE 'NOT'
END CASE
FROM SYSIBM/SYSDUMMY1
 
I was running it under z/OS from within QMF, DB2 v7.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top